Last active
August 29, 2015 14:26
-
-
Save ryenus/379fd68da7308b9efe05 to your computer and use it in GitHub Desktop.
HN Mod
This file contains hidden or 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 HN Mod | |
// @namespace http://gitub.com/ryenus | |
// @version 0.1 | |
// @description A nonintrusive Hacker News mod | |
// @author ryenus | |
// @match https://news.ycombinator.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var filters = [ | |
'a', | |
'not([onclick])', | |
'not([target])', | |
'not([class*=pocket])', | |
'not([href^="news"])', | |
'not([href^="#"])', | |
'not([href^=mailto])', | |
'not([href^=logout])' | |
], | |
links = document.querySelectorAll(filters.join(':')); | |
for (var i=0; i<links.length; i++) { | |
links[i].setAttribute('target', '_blank'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script makes most HN links open in new tabs.