jq_tweet_li.find("span.actions div a[id^=status_star]").unbind();
445
jq_tweet_li.find("span.actions div a[id^=status_star]").unbind();
...
...
507
jq_tweet_li.find("span.actions div a[id^=status_star]").attr("class",(json_tweet.favorited?"fav":"non-fav"));
447
jq_tweet_li.find("span.actions div a[id^=status_star]").attr("class",(json_tweet.favorited?"fav":"non-fav"));
508
jq_tweet_li.find("span.actions div a[id^=status_star]").attr("title",(json_tweet.favorited?"favorite this
update":"un-favorite this tweet"));
448
jq_tweet_li.find("span.actions div a[id^=status_star]").attr("title",(json_tweet.favorited?"favorite this
update":"un-favorite this tweet"));
509
449
510
//log("Adding retweet button, via convert_json method.");
511
512
513
jq_tweet_li.find("span.actions div a.retweet-link").unbind();
450
jq_tweet_li.find("span.actions div a.retweet-link").unbind();
514
451
515
jq_tweet_li.find("div.embedded-reply").remove();
452
jq_tweet_li.find("div.embedded-reply").remove();
...
...
519
{
456
{
520
jq_tweet_li.find("span.entry-meta").append(" <a
href='http://twitter.com/"+json_tweet.in_reply_to_screen_name+"/status/"+json_tweet.in_reply_to_status_id+"'>in reply to
"+json_tweet.in_reply_to_screen_name+"</a>")
457
jq_tweet_li.find("span.entry-meta").append(" <a
href='http://twitter.com/"+json_tweet.in_reply_to_screen_name+"/status/"+json_tweet.in_reply_to_status_id+"'>in reply to
"+json_tweet.in_reply_to_screen_name+"</a>")
//TODO: Nested Tweets seems to break this script. Why?//TODO: Eliminate the website from asking for login credentials twice. Unnecessary!//TODO: Set focus on textareas when shown via a reply or retweet. (Bug is thrown from some Twitter code, I believe. Focus() causes errors)//TODO: Create some kind of direct message mechanism on the main page, without refresh (hover-over user image, icon shows up?)//TODO: @reply helper (this will be hard. api only gets 100 users at a time, no way to filter through entire friend collection)//TODO: Threaded conversations//TODO: Toolbar//FIXED(3.2.09): Removed CSS highlighting when on single tweet-page//FIXED(2.27.09): HTTPS errors (via Karolis)//ADDED(2.27.09): TwitPic preview, at Karolis' request (http://userscripts.org/users/26455)//FIXED(2.27.09): Suspend self-highlights when viewing your own page (compare "a.profile_link:href" and ".profile-head a:href")//FIXED(2.24.09): Twitter changed their reply link class to "reply" and that broke my code. Changed to "reply2" for now//FIXED(2.17.09): Make embedded retweet/reply work on non-home pages (single tweet pages, or on profile pages)//FIXED(2.17.09): Get username from profile link if not on home page?//ADDED(2.10.09): Add update panel to page, to show user that there's a new version of the script (idea from Mislav via Endless Tweets userscript)//FIXED(2.10.09): Modify "new" tweet buttons on endless tweet load (reply, retweet, favorite, delete)//ADDED(2.10.09): Using jQuery.noconflict()//FIXED(2.10.09): Add regex so that if on /home and there's an anchor in the url (ie "#" or "#reply", etc), still load tweets//FIXED(2.10.09): Change time to actual time of post, not relative time.//FIXED(2.10.09): Do regex on each status to see if @current_username is in the text. If found, make sure the li has the "to_me" css class applied//FIXED(2.6.09): Clicking modified reply button still adds @reply to main status text area//REMOVED: Removed modified "favorite" button, as twitter seems to have fixed it's functionality//FIXED(2.6.09): Delete button no longer working--somehow, twitter overwrote previous code and javascript dialog always opens now (grrr!)//ADDED: Endless tweets using JSON//ADDED: Modify retweet (embedded retweet)//ADDED: Modify reply (embedded reply)//ADDED: Modify delete (to get it working, sometimes it doesn't work)//ADDED: Modify favorite (to get it working again, sometimes it doesn't work)//ADDED: slide and highlight animations//ADDED: Character counter near textareas//ADDED: Highlight replies to you (yellow?)//ADDED: Highlight own tweets (green)twitter_fantastico = function(){twitter_fantastico = function(){j('head').append("<style type='text/css'>"+page_css()+"</style>");j('head').append("<style type='text/css'>"+page_css()+"</style>");//add_bottom_actionbar();log("Loading page data");log("Loading page data");//load_page(false,useJQXHR);log("Attaching scroll event handler");log("Attaching scroll event handler");j(window).scroll(function(e){j(window).scroll(function(e){//window.pageYOffset//window.innerHeight//log("Y: "+window.pageYOffset+" WindowHeight: "+window.innerHeight);lastTweetTop = j("#timeline .status:last").offset().top;lastTweetTop = j("#timeline .status:last").offset().top;//log("Loading: "+loading+" LastPage: "+lastPage+" currentScrollPosition >= lastTweetTop - 20:" + (currentScrollPosition >= lastTweetTop - 20));{{new_jq_tweet.find("span.actions div").append("<a class='delete' title='delete this update' href='#delete'></a>");new_jq_tweet.find("span.actions div").append("<a class='delete' title='delete this update' href='#delete'></a>");find_reply_to_me_in_tweet_and_set_to_me_class(new_jq_tweet);if(j("#timeline").length>0)if(j("#timeline").length>0)new_jq_tweet.appendTo("#timeline");new_jq_tweet.appendTo("#timeline");find_reply_to_me_in_tweet_and_set_to_me_class(jq_tweet);//modify_nested_twitter_replies();//log("Done modifying tweets.");{{{{tweet.find("a.retweet-link").remove();tweet.find("a.retweet-link").remove();//log("Adding retweet button for "+ json_tweet.id);//log("Adding retweet button for " + json_tweet.id);if(tweet.find(".actions div").length==0)if(tweet.find(".actions div").length==0)jq_retweet_link = j("<a class='retweet-link' href='#retweet'>RT</a>").appendTo(tweet.find(".actions"));jq_retweet_link = j("<a class='retweet-link' href='#retweet'>RT</a>").appendTo(tweet.find(".actions"));show_embedded_retweet(j(this).data('json_tweet'));show_embedded_retweet(j(this).data('json_tweet'));//log("Done adding retweet");jq_embedded_retweet.appendTo(jq_tweet.find(".status-body")).effect('scale',{from:{height:0},percent:100,direction:'vertical',scale:'box'},300);jq_embedded_retweet.appendTo(jq_tweet.find(".status-body")).effect('scale',{from:{height:0},percent:100,direction:'vertical',scale:'box'},300);jq_textarea = jq_embedded_retweet.find("textarea.retweet-text");jq_textarea = jq_embedded_retweet.find("textarea.retweet-text");//jq_textarea.focus(function(){// counter_span = j(this).parent().find("span.counter");// counter_span.html(140-parseInt(j(this).val().length));//});counter_span = jq_textarea.parent().find("span.counter");counter_span = jq_textarea.parent().find("span.counter");{{//log("Modifying reply button for " + json_tweet.id);tweet.find(".actions .repl").remove();tweet.find(".actions .repl").remove();tweet.find(".actions .reply").remove();tweet.find(".actions .reply").remove();tweet.find(".actions .reply2").remove();tweet.find(".actions .reply2").remove();tweet.find(".reply2").remove();tweet.find(".reply2").remove();//log("Adding reply click-event for: "+jq_reply_link.parent().parent().parent().attr("id"));jq_reply_link.click(function(){jq_reply_link.click(function(){show_embedded_reply(j(this).data('json_tweet'));show_embedded_reply(j(this).data('json_tweet'));//log("Done modifying reply");{{jq_embedded_reply = j("<div id='reply_"+json_tweet.id+"' class='embedded-reply'><span class='counter'>140</span><br/><textarea class='reply-text'>@"+json_tweet.user.screen_name+"</textarea><br/><a class='reply-submit' href='#'>Reply</a><a class='reply-cancel' href='#'>Cancel</a></div>");jq_embedded_reply = j("<div id='reply_"+json_tweet.id+"' class='embedded-reply'><span class='counter'>140</span><br/><textarea class='reply-text'>@"+json_tweet.user.screen_name+"</textarea><br/><a class='reply-submit' href='#'>Reply</a><a class='reply-cancel' href='#'>Cancel</a></div>");jq_embedded_reply.appendTo(jq_tweet.find(".status-body")).effect('scale',{from:{height:0},percent:100,scale:'box',direction:'vertical'},300);jq_embedded_reply.appendTo(jq_tweet.find(".status-body")).effect('scale',{from:{height:0},percent:100,scale:'box',direction:'vertical'},300);jq_textarea = jq_embedded_reply.find("textarea.reply-text");jq_textarea = jq_embedded_reply.find("textarea.reply-text");//jq_textarea.focus(function(){// counter_span = j(this).parent().find("span.counter");// counter_span.html(140-parseInt(j(this).val().length));//});//jq_textarea.focus();counter_span = jq_textarea.parent().find("span.counter");counter_span = jq_textarea.parent().find("span.counter");jq_reply_link = jq_embedded_reply.find("a.reply-submit");jq_reply_link = jq_embedded_reply.find("a.reply-submit");jtweet = j(this).data('json_tweet');jtweet = j(this).data('json_tweet');jq_ta = j(this).data('jq_textarea');jq_ta = j(this).data('jq_textarea');jq_ta.parent().effect('scale',{percent:0,direction:'vertical',scale:'box'},300,function(){j(this).remove();});jq_ta.parent().effect('scale',{percent:0,direction:'vertical',scale:'box'},300,function(){j(this).remove();});//jq_ta.parent().remove();{{{{//log("current_username==json_tweet.user.screen_name: "+current_username+" == "+json_tweet.user.screen_name);//http://twitter.com/statuses/destroy/id.jsonjq_tweet_li.children(".actions a.reply2").attr("class","repl");jq_tweet_li.children(".actions a.reply2").attr("class","repl");jq_tweet_li.children(".actions .retweet-link").remove();jq_tweet_li.children(".actions .retweet-link").remove();jq_tweet_li.find("a:contains('in reply to')").remove();jq_tweet_li.find("a:contains('in reply to')").remove();//log("Using "+jq_tweet_li.attr("id")+" as a template for copy.");jq_tweet_li.attr("id","status_"+json_tweet.id);jq_tweet_li.attr("id","status_"+json_tweet.id);jq_tweet_li.attr("class","hentry status u-"+json_tweet.user.screen_name+(current_username==json_tweet.user.screen_name?" mine":""));jq_tweet_li.attr("class","hentry status u-"+json_tweet.user.screen_name+(current_username==json_tweet.user.screen_name?" mine":""));jq_tweet_li.find("span.author a.url").attr("href","http://twitter.com/"+json_tweet.user.screen_name);jq_tweet_li.find("span.author a.url").attr("href","http://twitter.com/"+json_tweet.user.screen_name);jq_tweet_li.find("span.status-body span.entry-meta a.entry-date span.published").attr("title",format_time(json_tweet.created_at) + " ago");jq_tweet_li.find("span.status-body span.entry-meta a.entry-date span.published").attr("title",format_time(json_tweet.created_at) + " ago");jq_tweet_li.find("span.status-body span.entry-meta a.entry-date span.published").html( format_time(json_tweet.created_at) + " ago");jq_tweet_li.find("span.status-body span.entry-meta a.entry-date span.published").html( format_time(json_tweet.created_at) + " ago");//jq_tweet_li.find("span.status-body span.entry-meta a.entry-date span.published").timeago();jq_tweet_li.find("span.status-body span.entry-meta a.entry-date + span").html("from " + json_tweet.source + " ");jq_tweet_li.find("span.status-body span.entry-meta a.entry-date + span").html("from " + json_tweet.source + " ");jq_tweet_li.find("span.actions div a[id^=status_star]").unbind();jq_tweet_li.find("span.actions div a[id^=status_star]").unbind();jq_tweet_li.find("span.actions div a[id^=status_star]").attr("class",(json_tweet.favorited?"fav":"non-fav"));jq_tweet_li.find("span.actions div a[id^=status_star]").attr("class",(json_tweet.favorited?"fav":"non-fav"));jq_tweet_li.find("span.actions div a[id^=status_star]").attr("title",(json_tweet.favorited?"favorite this update":"un-favorite this tweet"));jq_tweet_li.find("span.actions div a[id^=status_star]").attr("title",(json_tweet.favorited?"favorite this update":"un-favorite this tweet"));//log("Adding retweet button, via convert_json method.");jq_tweet_li.find("span.actions div a.retweet-link").unbind();jq_tweet_li.find("span.actions div a.retweet-link").unbind();jq_tweet_li.find("div.embedded-reply").remove();jq_tweet_li.find("div.embedded-reply").remove();{{jq_tweet_li.find("span.entry-meta").append(" <a href='http://twitter.com/"+json_tweet.in_reply_to_screen_name+"/status/"+json_tweet.in_reply_to_status_id+"'>in reply to "+json_tweet.in_reply_to_screen_name+"</a>")jq_tweet_li.find("span.entry-meta").append(" <a href='http://twitter.com/"+json_tweet.in_reply_to_screen_name+"/status/"+json_tweet.in_reply_to_status_id+"'>in reply to "+json_tweet.in_reply_to_screen_name+"</a>")//find_reply_to_me_in_tweet_and_set_to_me_class(jq_tweet_li);//helluva function name--bad practice on my part :)function set_to_me_class(jqTweet)function find_reply_to_me_in_tweet_and_set_to_me_class(jqTweet){{text = jqTweet.find(".status-body .entry-content").html();text = jqTweet.find(".status-body .entry-content").html();headers: { 'Accept-Encoding': '' }, //Thanks Mislavheaders: { 'Accept-Encoding': '' }, //Thanks Mislavonload:function(response){onload:function(response){//log("Response from userscripts.org: "+response.responseHeaders);log("Got script, length: "+scriptLength);log("Got script, length: "+scriptLength);{//show update linkj("<div><a href='http://userscripts.org/scripts/show/41387'>*Update to Twitter Fantastico is available*</a></div>").prependTo("td#content .wrapper");j("<div><a href='http://userscripts.org/scripts/show/41387'>*Update to Twitter Fantastico is available*</a></div>").prependTo("td#content .wrapper");}