Link Untracker

Remove tracking elements from links

Pada tanggal 29 November 2017. Lihat %(latest_version_link).

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.

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.

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

// ==UserScript==
// @name        Link Untracker
// @namespace   IzzySoft
// @description Remove tracking elements from links
// @license     CC BY-NC-SA
// @include     *
// @exclude     *phpmyadmin*
// @version     3
// @grant       unsafeWindow
// ==/UserScript==

var badp = ['utm_','referrer']; /* we strip parameters starting with that */
var anch = '';
var replace_semicolon = true; /* some sites use ";" to separate URL params;
                                 URLSearchParams can't deal with that and messes up.
                                 If those sites don't work with "&", either set this
                                 to "false" or add that site on the exclude list
                               */

for(var i = 0; i < document.links.length; i++) {
  var elem = document.links[i];
  if (elem.search == '') continue;
  if (replace_semicolon) var purl = new URLSearchParams(elem.search.replace(new RegExp(';','g'),'&'));
  else var purl = new URLSearchParams(elem.search);
  for (let b of badp) { purl.delete(b); }
  if (elem.href.indexOf('#') > 0) anch = '#' + elem.href.split('#')[1];
  else anch = '';
  elem.href = elem.href.split('?')[0] + '?' + purl.toString() + anch;
}