web/client.php
changeset 818 3b1607209743
parent 628 17b6e5fb1bce
child 820 7f52c555ad8d
--- a/web/client.php	Mon Mar 25 23:29:06 2013 +0100
+++ b/web/client.php	Mon Mar 25 23:30:09 2013 +0100
@@ -138,6 +138,21 @@
         _st.val( _val + ( _val[_val.length - 1] == " " ? "" : " " ) + value ).change();
     }
     
+    function tweet_text(text) {
+	    var url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(text),
+	    	popW = 550,
+	        popH = 350,
+	        scrW = screen.width,
+	        scrH = screen.height,
+	        posX = Math.round((scrW/2)-(popW/2)),
+	        posY = (scrH > popH ? Math.round((scrH/2)-(popH/2)) : 0);
+	    window.open(
+	    	url,
+	        '',
+	        'left=' + posX + ',top=' + posY + ',width=' + popW + ',height=' + popH + ',personalbar=0,toolbar=0,scrollbars=1,resizable=1'
+        );
+    }
+    
     $(document).ready(function() {
         
             
@@ -165,12 +180,15 @@
             
             // BUTTONS
             $(".tweetButton").click(function() {
+            	tweet_text("<?php echo($config['hashtag']); ?> " + $(this).find('span.twbSyntax').text());
+            	return false;
                 add_grammar($(this).find('span.twbSyntax').text());
                 updateCounter();
             })
             
             // SEND TWEETS
             $("#sendTweet").click(function(){
+            	return false;
                 var MyStatus = $('#status').val();
                 $.post('tweet_ajax.php', {status:MyStatus}
                 ,function(data) {
@@ -190,6 +208,11 @@
                 
             });
             
+            $("#sendTweet,.loginlink").click(function() {
+            	tweet_text("<?php echo($config['hashtag']); ?> ++ -- == ??");
+            	return false;
+            })
+            
 
             $("#status").bind("change keyup paste blur focus",updateCounter);