Fix links

Fixar utgående länkar på Flashback

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           Fix links
// @include        https://www.flashback.org/*
// @version 0.0.1.20140604192605
// @namespace https://greasyfork.org/users/2463
// @description Fixar utgående länkar på Flashback
// ==/UserScript==

(function () {

var leave = "https://www.flashback.org/leave.php?u=";

$x("//a[starts-with(@href, '" + leave + "')]").forEach(function (element)
{
GM_log("In loop");
	element.href = unescape(element.href.replace(leave, "")).replace(/&/gi, "&");
	if (!element.href.match(/:\/\//))	// No protocol, add http
		element.href = "http://" + element.href;
});



function $x(expression, context) {
  if (!context) context = document;
  var i, arr = [], xpr = document.evaluate(expression, context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  for (i = 0; item = xpr.snapshotItem(i); i++) arr.push(item);
  return arr;
}

})();