Last active
September 25, 2015 07:18
-
-
Save jackysee/884490 to your computer and use it in GitHub Desktop.
Twitter Quick Links userscript (press 1-9 to open link of current tweets in background)
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== | |
// @id TwitterQuickLinks | |
// @name Twitter Quick Links | |
// @namespace http://jacky.seezone.net/twitterQuickLinks | |
// @description press 1-9 to open link in current tweets in background tab | |
// @include https://twitter.com/* | |
// @include http://twitter.com/* | |
// ==/UserScript== | |
function linkKey(ev){ | |
if(ev.altKey || ev.ctrlKey || ev.shiftKey || | |
/input|textarea/.test(ev.target.tagName.toLowerCase()) || | |
ev.target.contentEditable === 'true'){ | |
return; | |
} | |
var k = String.fromCharCode(ev.keyCode ||ev.which); | |
if(k >= "1" && k <= "9"){ | |
var i = parseInt(k,10)-1, | |
link = document.querySelectorAll(".selected-stream-item a.twitter-timeline-link"); | |
link.length>i && link[i] && GM_openInTab(link[i].href); | |
} | |
} | |
document.addEventListener('keypress', linkKey, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment