Makes urls open directly
目前為
// ==UserScript==
// @name biglistofwebsites direct urls
// @description Makes urls open directly
// @include http://biglistofwebsites.com/
// @include http://biglistofwebsites.com/list-top*
// @version 1.0
// @author wOxxOm
// @namespace wOxxOm.scripts
// @license MIT License
// @grant none
// @run-at document-start
// ==/UserScript==
setMutationHandler(document, 'a[href*="go/"]', function(observer, nodes) {
for (var i=0, nl=nodes.length; i<nl && (n=nodes[i]); i++)
n.href = n.href.replace(/^(|.+?\/)go/, 'http://');
return true;
});
function setMutationHandler(baseNode, selector, cb) {
var ob = new MutationObserver(function(mutations){
for (var i=0, ml=mutations.length, m; (i<ml) && (m=mutations[i]); i++)
for (var j=0, nodes=m.addedNodes, nl=nodes.length, n; (j<nl) && (n=nodes[j]); j++)
if (n.nodeType == 1)
if ((n = n.matches(selector) ? [n] : n.querySelectorAll(selector)) && n.length)
if (!cb(ob, n))
return;
});
ob.observe(baseNode, {subtree:true, childList:true});
}