Google Optimization

Google Search Page Optimization

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

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