Skip to content

Instantly share code, notes, and snippets.

@coagulant
Created October 23, 2010 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coagulant/642577 to your computer and use it in GitHub Desktop.
Save coagulant/642577 to your computer and use it in GitHub Desktop.
Allow retweet with RT
// ==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);
@coagulant
Copy link
Author

Пока работает только в основном timeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment