Decloak links and open directly

Open redirected/cloaked links directly

Verze ze dne 15. 03. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name          Decloak links and open directly
// @description   Open redirected/cloaked links directly
// @version       1.1.0
// @author        wOxxOm
// @namespace     wOxxOm.scripts
// @icon          https://i.imgur.com/cfmXJHv.png
// @license       MIT License
// @run-at        document-start
// @include       *
// ==/UserScript==

/* jshint lastsemic:true, multistr:true, laxbreak:true, -W030, -W041, -W084 */

window.addEventListener('mousedown', decloak, true);
window.addEventListener('keydown', function(e) { if (e.keyCode == 13) decloak(e) }, true);

function decloak(e) {
	var a = e.target.closest('a');
	if (!a)
		return;

	var m = a.href.match(/=(\w+(?::\/\/|%3[Aa]%2[Ff]%2[Ff])[^+&?]+)/);
	if (!m)
		return;

	if (e.altKey)
		return console.debug('Decloak skipped: Alt key is pressed.');

	var realUrl = decodeURIComponent(m[1]);
	if (new URL(realUrl).hostname == a.hostname)
		return console.debug('Decloak skipped: the hostnames are same, assumed a login redirection.');

	a.href = realUrl;
}