Created
December 1, 2008 15:32
-
-
Save bumi/30753 to your computer and use it in GitHub Desktop.
adds a nice RT button to the tweet action buttons that allows you to instantly retweet a post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ReTweeter = { | |
initialize: function() { | |
$(".status").each(function(count,status) { | |
var actions = $(status).find("td.actions div"); | |
var link = $("<a/>").attr({href:"/home/?status="+ReTweeter.reTweetOf(status)}); | |
link.append( $("<img/>").attr({src:"http://railslove.com/rt.gif", alt:"REtweet this"}) ) | |
link.bind("click",function(e){ | |
e.preventDefault(); | |
var status = $(this).parents(".status"); | |
$("#status").val(ReTweeter.reTweetOf(status)); | |
$("#status").trigger("click"); | |
$("#status").trigger("focus"); | |
$("#doingForm").trigger("submit"); | |
}); | |
actions.append(link); | |
}); | |
}, | |
authorOf: function(status) { | |
return $(status).find("td.status-body div strong a").text(); | |
}, | |
textOf: function(status) { | |
return $(status).find(".status-body div span.entry-content").text().replace(/^\s+/, '').replace(/\s+$/, ''); | |
}, | |
reTweetOf: function(status){ | |
return ("RT @" + ReTweeter.authorOf(status) + ":" + ReTweeter.textOf(status)).substring(0,139); | |
} | |
} | |
ReTweeter.initialize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RETweet | |
// version 0.1 BETA! | |
// 2008-11-14 | |
// | |
// -------------------------------------------------------------------- | |
// | |
// | |
// | |
// -------------------------------------------------------------------- | |
// | |
// ==UserScript== | |
// @name ReTweet | |
// @namespace http://railslove.com | |
// @description Adds a nice RT button to the tweet action buttons that allows you to instantly retweet an post | |
// @include *twitter.com* | |
// ==/UserScript== | |
var head = document.getElementsByTagName("head")[0]; | |
var script = document.createElement("script"); | |
script.src = "http://railslove.com/retweeter.js"; | |
script.type = "text/javascript"; | |
head.appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment