google_direct_link

Google direct link for avoiding laggy '/url?' link.

Από την 08/01/2017. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        google_direct_link
// @namespace   http://catherine.v0cyc1pp.com/google_direct_link.user.js
// @include     https://www.google.co.jp/search*
// @run-at      document-end
// @author      greg10
// @license     GPL 3.0
// @version     1.4
// @require     http://code.jquery.com/jquery-3.1.1.min.js
// @grant       none
// @description Google direct link for avoiding laggy '/url?' link.
// ==/UserScript==

// [desctiption details]
// This script will replace link google search results.
//
//https://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjzmeD83cnQAhVBPpQKHQtkC6wQFggbMAA&url=http%3A%2F%2Fwww.nyc.gov%2F&usg=AFQjCNGtbMsqtosAyddPnaeiyyG142mO3A&bvm=bv.139782543,d.dGo
// to
//http://www.nyc.gov/
//
// for avoiding laggy '/url?' link.

this.$ = this.jQuery = jQuery.noConflict(true);
//console.log("google_direct_link start");

function replacelink(target) {
	var str = $(target).attr("href");
	//console.log("str="+str);
	if ( str === null || str === undefined ) {
		return;
	}
	var result = str.match( /&url=([^&]+)&/ );
	if ( result !== null && result !== undefined ) {
		var direct = result[1];
		if ( direct !== null && direct !== undefined ) {
			var decoded = decodeURIComponent( direct );
			$(target).attr("href", decoded);

		}
	}
}

function main() {
	$("a").each( function() {
		replacelink(this);
	});
}


var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe( document, config);
});

var config = { attributes: true, childList: true, characterData: true, subtree:true };

observer.observe( document, config);