Last active
July 10, 2022 13:10
-
-
Save mono0x/4a6d2f19ca90668e41f85bb1c1952828 to your computer and use it in GitHub Desktop.
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 Inoreader open in background tab | |
// @namespace http://mono0x.net/ | |
// @version 0.0.1 | |
// @author mono | |
// @match https://www.inoreader.com/* | |
// @match https://irodr.netlify.app/* | |
// @grant GM_openInTab | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const w = unsafeWindow || window; | |
const open = w.open; | |
w.open = (url, name) => { | |
if (url === undefined) { | |
return open(url, name); | |
} | |
GM_openInTab(url, { | |
active: false, | |
insert: true, | |
setParent: true, | |
}); | |
return true; | |
}; | |
document.addEventListener('click', (evt) => { | |
if (evt.target.href && evt.target.target === '_blank') { | |
evt.preventDefault(); | |
w.open(evt.target.href, '_blank'); | |
} | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment