Cologler
8/13/2017 - 8:20 AM

#contextmenu_script

#contextmenu_script

// https://gist.github.com/Cologler/aa8ea428a9dffdfbeb02909740e73bde
'use strict';

(function() {
    let as = [].__proto__.slice.bind(document.querySelectorAll('a'))();
    if (as.some(z => z['href.backup'])) {
        console.log('enable <a>');
        as.forEach(z => {
            if (z['href.backup']) {
                z.setAttribute('href', z['href.backup']);
                delete z['href.backup'];
            }
        });
    } else {
        console.log('disable <a>');
        as.forEach(z => {
            z['href.backup'] = z.href;
            z.removeAttribute('href');
        });
    }
})();