Changeset 70

User picture

Author: frojo56

(2009/02/25 03:52) Almost 3 years ago

Changed .reply class to .reply2 (thanks, Twitter)
Release candidate

Affected files

Updated twitter_fantastico.user.js Download diff

6970
25
//ADDED: Highlight replies to you (yellow?)
25
//ADDED: Highlight replies to you (yellow?)
26
//ADDED: Highlight own tweets (green)
26
//ADDED: Highlight own tweets (green)
27
27
28
//FIXED(2.24.09): Twitter changed their reply link class to "reply" and that broke my code. Changed to "reply2" for now
28
//FIXED(2.17.09): Make embedded retweet/reply work on non-home pages (single tweet pages, or on profile pages)
29
//FIXED(2.17.09): Make embedded retweet/reply work on non-home pages (single tweet pages, or on profile pages)
29
//FIXED(2.17.09): Get username from profile link if not on home page?
30
//FIXED(2.17.09): Get username from profile link if not on home page?
30
//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)
31
//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)
...
...
342
function modify_reply_button(tweet,json_tweet)
343
function modify_reply_button(tweet,json_tweet)
343
{
344
{
344
	//log("Modifying reply button for " + json_tweet.id);
345
	//log("Modifying reply button for " + json_tweet.id);
345
	tweet.find(".actions a.repl").remove();
346
	tweet.find(".actions .repl").remove();
346
	tweet.find(".actions a.reply").remove();
347
	tweet.find(".actions .reply").remove();
348
	tweet.find(".actions .reply2").remove();
347
	if(tweet.find(".actions div").length>0)
349
	if(tweet.find(".actions div").length>0)
348
		jq_reply_link = j("<a class='reply' href='#reply'></a>").appendTo(tweet.find(".actions div"));
350
		jq_reply_link = j("<a class='reply2' href='#reply'></a>").appendTo(tweet.find(".actions div"));
349
	else
351
	else
350
		jq_reply_link = j("<a class='reply' href='#reply'></a>").appendTo(tweet.find(".actions"));
352
		jq_reply_link = j("<a class='reply2' href='#reply'></a>").appendTo(tweet.find(".actions"));
351
	jq_reply_link.css({"height":"16px","background-image":"url(http://static.twitter.com/images/icon_reply.gif)"});
353
	jq_reply_link.css({"height":"16px","background-image":"url(http://static.twitter.com/images/icon_reply.gif)"});
352
	jq_reply_link.data('json_tweet',json_tweet);
354
	jq_reply_link.data('json_tweet',json_tweet);
353
	if(json_tweet.user.screen_name == current_username)
355
	if(json_tweet.user.screen_name == current_username)
...
...
355
		log("Removing reply button, as this is the current user's tweet.");
357
		log("Removing reply button, as this is the current user's tweet.");
356
		tweet.find(".reply").remove();
358
		tweet.find(".reply").remove();
357
		tweet.find(".repl").remove();
359
		tweet.find(".repl").remove();
360
		tweet.find(".reply2").remove();
358
		return false;
361
		return false;
359
	}
362
	}
360
	//log("Adding reply click-event for: "+jq_reply_link.parent().parent().parent().attr("id"));
363
	//log("Adding reply click-event for: "+jq_reply_link.parent().parent().parent().attr("id"));
...
...
452
	jq_tweet_li = j("a.repl").eq(0).parent().parent().parent().clone();
455
	jq_tweet_li = j("a.repl").eq(0).parent().parent().parent().clone();
453
	if(jq_tweet_li.length == 0)
456
	if(jq_tweet_li.length == 0)
454
		jq_tweet_li = j("a.reply").eq(0).parent().parent().parent().clone();
457
		jq_tweet_li = j("a.reply").eq(0).parent().parent().parent().clone();
458
	if(jq_tweet_li.length == 0)
459
		jq_tweet_li = j("a.reply2").eq(0).parent().parent().parent().clone();
455
	jq_tweet_li.children(".actions a.reply").attr("class","repl");
460
	jq_tweet_li.children(".actions a.reply").attr("class","repl");
461
	jq_tweet_li.children(".actions a.reply2").attr("class","repl");
456
	jq_tweet_li.children(".actions .retweet-link").remove();
462
	jq_tweet_li.children(".actions .retweet-link").remove();
457
	jq_tweet_li.find("a:contains('in reply to')").remove();
463
	jq_tweet_li.find("a:contains('in reply to')").remove();
458
	//log("Using "+jq_tweet_li.attr("id")+" as a template for copy.");
464
	//log("Using "+jq_tweet_li.attr("id")+" as a template for copy.");
...
...
495
}
501
}
496
function determine_what_page_user_is_on()
502
function determine_what_page_user_is_on()
497
{
503
{
498
	//reUrlSplitUp=/^https?:\/\/(?:www\.)?twitter\.com(\/([\w\d]+)(\/status\/(\d+))?(?:.*page=(\d+))?)(?:#.*)?$/.exec(location.href);
499
	reUrlSplitUp=/https?:\/\/(?:www\.)?twitter.com\/([\w\d]+)(?:\/(statuses)\/(\d+))?(?:\?page=(\d+))?/.exec(location.href);
504
	reUrlSplitUp=/https?:\/\/(?:www\.)?twitter.com\/([\w\d]+)(?:\/(statuses)\/(\d+))?(?:\?page=(\d+))?/.exec(location.href);
500
	// 1: directory right after twitter.com (ie: home or carl_furrow, etc)
505
	// 1: directory right after twitter.com (ie: home or carl_furrow, etc)
501
	// 2: the word "statuses" if in the url (what did I want to use this for?)
506
	// 2: the word "statuses" if in the url (what did I want to use this for?)