commit ea3713da2f4f9bfad2f63541017c8cb2962b5da6 Author: vlw Date: Sat Mar 21 12:25:49 2026 +0100 add: "script.js" diff --git a/script.js b/script.js new file mode 100644 index 0000000..c0dc893 --- /dev/null +++ b/script.js @@ -0,0 +1,22 @@ +// ==UserScript== +// @name Open Reddit posts in new tab +// @namespace https://vlw.se/ +// @version 1.1.0 +// @description A script that opens Reddit posts in a new tab without the need to be logged in +// @author Victor Westerlund +// @match https://www.reddit.com/* +// @icon https://www.redditstatic.com/shreddit/assets/favicon/64x64.png +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + document.body.addEventListener('click', (event) => { + if (event.target instanceof HTMLAnchorElement) { + event.preventDefault(); + + window.open(event.target.href); + } + }); +})();