biglistofwebsites direct urls

Makes urls open directly

目前為 2015-03-26 提交的版本,檢視 最新版本

// ==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}); 
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址