Straight Techgig

Remove URL redirection from TechGig

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name Straight Techgig
// @id	straight_techgig_xifos
// @namespace	  in.co.tossing.toolkit.techgig
// @description	Remove URL redirection from TechGig
// @license	GPL v3 or later version
// @include		*://www.techgig.com/*
// @version	0.1
// @author	XiFoS
// ==/UserScript==

(function (d) {
	var all_a = d.getElementsByTagName('a');
	var a = null;
	var match;
	for(i = 0; i < all_a.length; i++) {
		a = all_a.item(i);
		if(a.href) {
			match = a.href.match(/readnews\.php/);
			if(match) {
				a.href = getQueryVariable(a.href, 'tgnews_link');
			}
		}
	}

	function urldecode(url) {
		return decodeURIComponent(url.replace(/\+/g, ' '));
	}

	function getQueryVariable(url, variable) {
		// remove all until the first `?`
		var query = url.split('?');
		query.shift(1);
		var vars = query.join('?').split('&');
		for (var i = 0; i < vars.length; i++) {
			var pair = vars[i].split('=');
			if (urldecode(pair[0]) == variable) {
				return urldecode(pair[1]);
			}
		}
		return null;
	}
})(document);