Last active
July 15, 2021 15:47
-
-
Save liberize/11262187 to your computer and use it in GitHub Desktop.
Revisions
-
liberize renamed this gist
Apr 24, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
liberize created this gist
Apr 24, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ // ==UserScript== // @name 禁止google结果跳转 // @namespace http://blog.whosemind.net // @description 去掉google搜索结果的跳转(http://www.google.com/url?), 而直接用原始链接 // @version 0.0.7 // @include /^https?:\/\/www\.google\.[^\/]+?\/(#.*|webhp.*|search\?.*)?$/ // ==/UserScript== var eles, timer, s, parse, url, loop = function () { var fn = function () { try { console.log('looping... '); var res = document.getElementsByClassName('l'), eid = document.getElementById('rso'), v = document.getElementById('lst-ib') .value, l = res.length, end = function () { setTimeout(function () { eles = eid; s = v; //console.log(l); for (var i = 0; i < l; i++) { res[i].setAttribute('onmousedown', ''); } console.log('done'); clearInterval(timer); }, 10); }, sf = document.getElementById('tsf'), ofn = sf.onsubmit; if (!_flag) { _flag = true; sf.onsubmit = function () { console.log('11'); return ofn.apply(this, arguments); }; } eid = eid ? eid.getAttribute('eid') : ''; //l && console.log(eid); if (l && (eid !== eles || v == s)) { end(); } unsafeWindow.rwt = function () { }; } catch (e) { } }; clearInterval(timer); timer = setInterval(fn, 1000); fn(); }, _flag; loop(); unsafeWindow.addEventListener('hashchange', loop, false);