add: "script.js"

This commit is contained in:
Victor Westerlund 2026-03-21 12:25:49 +01:00
commit ea3713da2f

22
script.js Normal file
View file

@ -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);
}
});
})();