[ALL] Links Open ALL in NEW BACKGROUND Tab

Open ALL links in NEW BACKGROUND tab.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name            [ALL] Links Open ALL in NEW BACKGROUND Tab
// @author
// @description     Open ALL links in NEW BACKGROUND tab.
// @downloadURL
// @grant           GM_openInTab
// @homepageURL     https://bitbucket.org/INSMODSCUM/userscripts-scripts/src
// @icon
// @include         http*://*
// @namespace       insmodscum 
// @require         https://greatest.deepsurf.us/scripts/12228/code/setMutationHandler.js
// @run-at          document-start
// @updateURL
// @version         1.0
// ==/UserScript==

// needs this in metadata:
// @require         https://greatest.deepsurf.us/scripts/12228/code/setMutationHandler.js

// source:
// https://greatest.deepsurf.us/en/scripts/12367-open-links-in-new-tab/code

attachHandler([].slice.call(document.getElementsByTagName('a')));

setMutationHandler(document, 'a', function(nodes) {
    attachHandler(nodes);
    return true;
});

function attachHandler(nodes) {
    nodes.forEach(function(node) {
        if (node.target != '_blank') {
            node.onclick = clickHandler;
            node.addEventListener('click', clickHandler);
        }
    });
}

function clickHandler(e) {
    if (e.button > 1)
        return;
    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();
    // GM_openInTab(this.href, e.button || e.ctrlKey);
    GM_openInTab(this.href, true);
}