diff -r a28c8c70741c -r 3b1607209743 web/client.php --- 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(" " + $(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(" ++ -- == ??"); + return false; + }) + $("#status").bind("change keyup paste blur focus",updateCounter);