Link Untracker

Remove tracking elements from links

Stan na 07-12-2017. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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

var badp = ['utm_','wt_','WT.','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;
}