Skip to content

Instantly share code, notes, and snippets.

@u1tnk
Created February 14, 2022 07:31
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 u1tnk/3f75ae18cf7951af9019fcaefe6e8a33 to your computer and use it in GitHub Desktop.
Save u1tnk/3f75ae18cf7951af9019fcaefe6e8a33 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Inoreader open in background tab
// @namespace http://mono0x.net/
// @version 0.0.1
// 元は https://gist.github.com/mono0x/4a6d2f19ca90668e41f85bb1c1952828
// @author mono/u1tnk
// 以下 include指定が /*が無いと入らなかったので修正
// @include https://www.inoreader.com/*
// @include 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,
});
// 以下ポップアップ許可してもポップアップブロッカー警告が出るので無理矢理削除
document.getElementsByClassName('inno_dialog')[0].remove();
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