Google Optimization

Google Search Page Optimization

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Google Optimization
// @namespace   0x123.com
// @author      Elf Sundae
// @description Google Search Page Optimization
// @copyright   www.0x123.com
// @icon        http://img-cdn.0x321.com/stuff/googleg_lodp.png
// @encoding    utf-8
// @run-at      document-end
// @include     /^https?://www\.google\.com
// @date        28/07/2014
// @modified    19/07/2016
// @version     1.0.2
// ==/UserScript==

/**
 * https://greasyfork.org/scripts/20228-google-optimization
 */

if (document.URL.match(/[\?#&]q=/g)) {
  remove_url_tracker();
}

function remove_url_tracker() {
  window.RemoveURLTrackerTimer = setInterval(function() {
    var iresDiv = document.getElementById('ires');
    if (!iresDiv) {
      return;
    }

    clearInterval(window.RemoveURLTrackerTimer);
    var links = iresDiv.getElementsByTagName('a');
    Array.prototype.slice.call(links).forEach(function(a) {
      a.removeAttribute("onmousedown");
      var url = a.getAttribute('data-href');
      if (url) {
        a.setAttribute('href', url);
      }
    });

    var resultStats = document.getElementById('resultStats');
    resultStats.innerHTML += "<nobr>&nbsp;<i>Removed URL tracker.</i>&nbsp;</nobr>";

  }, 100);
}