Skip to content

Instantly share code, notes, and snippets.

@DavideViolante
Last active October 18, 2022 12:58
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 DavideViolante/04e42628b9e6b4a2f8aec3875e44990c to your computer and use it in GitHub Desktop.
Save DavideViolante/04e42628b9e6b4a2f8aec3875e44990c to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name HN target blank
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Open Hacker News links in a new tab
// @author Davide Violante
// @match https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const titles = document.getElementsByClassName('titleline');
for (const title of titles) {
title.childNodes[0].setAttribute('target', '_blank');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment