1 $(document).ready(function(){
2 $('#tweet_body').focus();
4 $('#tweet_body').keypress(function(){
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.
9 function update_share() {
10 var text = encodeURIComponent( $('#tweet_body').val() );
11 var url = encodeURIComponent( $('#copylink').val() );
12 var tw = 'http://twitter.com/intent/tweet?status='+text;
13 var ff = 'http://friendfeed.com/share/bookmarklet/frame#title='+text ;
14 var fb = 'http://www.facebook.com/share.php?u='+url ;
15 $('#share_tw').attr('href', tw);
16 $('#share_ff').attr('href', ff);
17 $('#share_fb').attr('href', fb);
19 var charcount = parseInt(140 - $('#tweet_body').val().length);
21 .toggleClass("negative", charcount < 0)
25 function share(dest) {
26 var url = $('#share_'+dest).attr('href');
29 //$('body').append('<script type="text/javascript" src="http://friendfeed.com/share/bookmarklet/javascript"></script>');
30 window.open(url, 'ff','toolbar=no,width=500,height=350');
33 //var url = $('#share_fb').attr('href');
34 window.open( url, 'fb','toolbar=no,width=1000,height=550');
37 //var url = $('#share_tw').attr('href');
38 window.open(url, 'tw','toolbar=no,width=800,height=550');
44 function init_clipboard() {
45 $('#copylink').click(function(){
49 $('#copylink').zclip({
51 copy: $('#copylink').val(),
53 html_pulse( '#copybox h2, #copybox h3', 'Copied!' );