1 $(document).ready(function(){
\r
2 $('#tweet_body').focus();
\r
4 $('#tweet_body').keypress(function(){
\r
5 setTimeout( function(){update_share()}, 50 ); // we're delaying, otherwise keypress() always triggers too fast before current key press actually inserts a letter?!! Go figure.
\r
9 function update_share() {
\r
10 var text = encodeURIComponent( $('#tweet_body').val() );
\r
11 var url = encodeURIComponent( $('#copylink').val() );
\r
12 var tw = 'http://twitter.com/intent/tweet?status='+text;
\r
13 var ff = 'http://friendfeed.com/share/bookmarklet/frame#title='+text ;
\r
14 var fb = 'http://www.facebook.com/share.php?u='+url ;
\r
15 $('#share_tw').attr('href', tw);
\r
16 $('#share_ff').attr('href', ff);
\r
17 $('#share_fb').attr('href', fb);
\r
19 var charcount = parseInt(140 - $('#tweet_body').val().length);
\r
21 .toggleClass("negative", charcount < 0)
\r
25 function share(dest) {
\r
26 var url = $('#share_'+dest).attr('href');
\r
29 //$('body').append('<script type="text/javascript" src="http://friendfeed.com/share/bookmarklet/javascript"></script>');
\r
30 window.open(url, 'ff','toolbar=no,width=500,height=350');
\r
33 //var url = $('#share_fb').attr('href');
\r
34 window.open( url, 'fb','toolbar=no,width=1000,height=550');
\r
37 //var url = $('#share_tw').attr('href');
\r
38 window.open(url, 'tw','toolbar=no,width=800,height=550');
\r
44 function init_clipboard() {
\r
45 $('#copylink').click(function(){
\r
49 $('#copylink').zclip({
\r
51 copy: $('#copylink').val(),
\r
52 afterCopy:function(){
\r
53 html_pulse( '#copybox h2, #copybox h3', 'Copied!' );
\r