Remover GoogleHistory

Remove em qual link foi clicado por último no Google

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                   Remover GoogleHistory
// @description            Remove em qual link foi clicado por último no Google
// @namespace              CowanGOOGLE
// @license                CowBas
// @version                1.0
// @author                 Cowanbas
// @match                  *://*/*
// @match                  *://*.google.tld/*
// @match                  *://www.google.tld/search?*
// @run-at                 document-start
// ==/UserScript==

// Desativa o Google Analytics
(function () {
  'use strict';

  unsafeWindow._gaUserPrefs = {
    ioo() {
      return true;
    }
  }
})();

// Impede a modificação da função rwt
Object.defineProperty(unsafeWindow, 'rwt', {
  value: function () { },
  writable: false
});

// Modifica os links nos resultados de pesquisa, removendo o redirecionamento do Google
if (document.querySelector('.cleanslate')) {
  let results = document.querySelectorAll('a[href^="/url"]');
  for (let i = 0; i < results.length; i++) {
    let url = new URL(results[i].href);
    results[i].href = url.searchParams.get('q');
  }
}

else if (document.querySelector('#desktop-search')) {
  let results = document.querySelectorAll('.r a');
  for (let i = 0; i < results.length; i++) {
    let url = new URL(results[i].href);
    results[i].href = url.searchParams.get('q');
  }
}