Skip to content

Instantly share code, notes, and snippets.

@mono0x
Last active July 10, 2022 13:10
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 mono0x/4a6d2f19ca90668e41f85bb1c1952828 to your computer and use it in GitHub Desktop.
Save mono0x/4a6d2f19ca90668e41f85bb1c1952828 to your computer and use it in GitHub Desktop.
// ==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