Decloak links and open directly

Open redirected/cloaked links directly

اعتبارا من 15-03-2017. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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;
}