replace goog tracking url

expose original simple links without tracking callbacks

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        replace goog tracking url
// @description        expose original simple links without tracking callbacks
// @namespace   *.google.*
// @version     1
// @grant       none
// @include     *.google.*
// @includes    *.google.*
// ==/UserScript==

function replace_url(elem, attr) {
    var elems = document.getElementsByTagName(elem);
    for (var i = 0; i < elems.length; i++){
        elems[i][attr] = elems[i][attr].replace('https://www.google.com/url?q=', '');
        elems[i][attr] = elems[i][attr].replace('http://www.google.com/url?q=', '');  
        elems[i][attr] = elems[i][attr].replace('https://encrypted.google.com/url?q=', ''); 
        elems[i][attr] = elems[i][attr].replace('https://www.google.com/aclk?', ''); 
        elems[i][attr] = elems[i][attr].replace('/url?q=http', 'http');  
        elems[i][attr] = elems[i][attr].replace(/sa=.*http/, 'http');  
        elems[i][attr] = elems[i][attr].replace(/&sa=.*/, '');  
        elems[i][attr] = elems[i][attr].replace('https://www.google.com/http', 'http'); 
        elems[i][attr] = unescape(elems[i][attr]);
        
    }
}

// window.onload = function() {
    console.log("greasemonkey launched");
    replace_url('a', 'href');
    replace_url('img', 'src');
    // etc
// }