web/client.php
changeset 818 3b1607209743
parent 628 17b6e5fb1bce
child 820 7f52c555ad8d
equal deleted inserted replaced
817:a28c8c70741c 818:3b1607209743
   136         var _st = $('#status'),
   136         var _st = $('#status'),
   137             _val = _st.val();
   137             _val = _st.val();
   138         _st.val( _val + ( _val[_val.length - 1] == " " ? "" : " " ) + value ).change();
   138         _st.val( _val + ( _val[_val.length - 1] == " " ? "" : " " ) + value ).change();
   139     }
   139     }
   140     
   140     
       
   141     function tweet_text(text) {
       
   142 	    var url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(text),
       
   143 	    	popW = 550,
       
   144 	        popH = 350,
       
   145 	        scrW = screen.width,
       
   146 	        scrH = screen.height,
       
   147 	        posX = Math.round((scrW/2)-(popW/2)),
       
   148 	        posY = (scrH > popH ? Math.round((scrH/2)-(popH/2)) : 0);
       
   149 	    window.open(
       
   150 	    	url,
       
   151 	        '',
       
   152 	        'left=' + posX + ',top=' + posY + ',width=' + popW + ',height=' + popH + ',personalbar=0,toolbar=0,scrollbars=1,resizable=1'
       
   153         );
       
   154     }
       
   155     
   141     $(document).ready(function() {
   156     $(document).ready(function() {
   142         
   157         
   143             
   158             
   144             function updateCounter() {
   159             function updateCounter() {
   145                 var _v = $("#status").val();
   160                 var _v = $("#status").val();
   163                 });
   178                 });
   164             }
   179             }
   165             
   180             
   166             // BUTTONS
   181             // BUTTONS
   167             $(".tweetButton").click(function() {
   182             $(".tweetButton").click(function() {
       
   183             	tweet_text("<?php echo($config['hashtag']); ?> " + $(this).find('span.twbSyntax').text());
       
   184             	return false;
   168                 add_grammar($(this).find('span.twbSyntax').text());
   185                 add_grammar($(this).find('span.twbSyntax').text());
   169                 updateCounter();
   186                 updateCounter();
   170             })
   187             })
   171             
   188             
   172             // SEND TWEETS
   189             // SEND TWEETS
   173             $("#sendTweet").click(function(){
   190             $("#sendTweet").click(function(){
       
   191             	return false;
   174                 var MyStatus = $('#status').val();
   192                 var MyStatus = $('#status').val();
   175                 $.post('tweet_ajax.php', {status:MyStatus}
   193                 $.post('tweet_ajax.php', {status:MyStatus}
   176                 ,function(data) {
   194                 ,function(data) {
   177                 
   195                 
   178                     if(data=="true"){
   196                     if(data=="true"){
   187                     }
   205                     }
   188                     
   206                     
   189                 });
   207                 });
   190                 
   208                 
   191             });
   209             });
       
   210             
       
   211             $("#sendTweet,.loginlink").click(function() {
       
   212             	tweet_text("<?php echo($config['hashtag']); ?> ++ -- == ??");
       
   213             	return false;
       
   214             })
   192             
   215             
   193 
   216 
   194             $("#status").bind("change keyup paste blur focus",updateCounter);
   217             $("#status").bind("change keyup paste blur focus",updateCounter);
   195             
   218             
   196             
   219