Created
October 23, 2010 19:13
-
-
Save coagulant/642577 to your computer and use it in GitHub Desktop.
Allow retweet with RT
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
// ==UserScript== | |
// @name Old school RT | |
// @namespace http://prophet.ru | |
// @description Allow retweet with RT | |
// @include http://twitter.com/ | |
// @include http://twitter.com/* | |
// ==/UserScript== | |
function main() { | |
function init(){ | |
appendOldRTLinks(); | |
bindOldRTAction(); | |
} | |
function appendOldRTLinks() { | |
twttr.templates.tweet_actions = twttr.templates.tweet_actions.replace("\n</span>", | |
'<a href="#" class="retweet-action old-rt"><span><i/><b>RT</b></span></a></span>'); | |
} | |
function bindOldRTAction() { | |
twttr.oldSetup = twttr.setup; | |
twttr.setup = function() { | |
twttr.oldSetup(); | |
$('.stream-items').delegate('.old-rt', 'click', clickRTLinkHandler); | |
} | |
} | |
function clickRTLinkHandler(e){ | |
e.preventDefault() | |
e.stopPropagation(); | |
var userName = $(this).closest('div.tweet-content').find('a.tweet-screen-name').text(); | |
var twitText = $(this).closest('div.tweet-content').find('div.tweet-text').text() | |
createRText(userName, twitText); | |
} | |
function createRText(userName, twitText) { | |
(new (twttr.widget.TweetDialog)({ | |
modal: false, | |
draggable: true, | |
template: {title: _('Old school retweet')} | |
}) | |
).setContent('RT @' + userName + ' ' + twitText) | |
.open() | |
.focus() | |
.setCaretPosition(0); | |
} | |
init(); | |
} | |
var script = document.createElement("script"); | |
var scriptcontent = 'window.onload = function() { '+main.toString().substr(18)+';'; | |
script.textContent = scriptcontent; | |
document.body.appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Пока работает только в основном timeline