Created
April 11, 2019 22:26
-
-
Save nbar1/37b9f84f9b469ad4082f271330c5ba18 to your computer and use it in GitHub Desktop.
Open HN story and comment links in a new tab
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 HackerNews New Tab | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Open story and comment links in a new tab | |
// @author Nick Barone | |
// @match https://news.ycombinator.com/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Story links | |
document.querySelectorAll('.storylink').forEach(link => link.setAttribute('target', '_blank')); | |
// Comment links | |
document.querySelectorAll('.subtext > a:last-child').forEach(link => link.setAttribute('target', '_blank')); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment