Tracking Hash Remover

This removes the random fragment identifiers used to track you.

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

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

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==
// @author       James Edward Lewis II
// @name         Tracking Hash Remover
// @namespace    greasyfork.org
// @version      0.0.1
// @description  This removes the random fragment identifiers used to track you.
// @grant        none
// @include      *
// @license MIT
// @copyright    2015+, James Edward Lewis II
// @run-at       document-start
// ==/UserScript==

(function trackingHashRemover(window, undefined) {
  'use strict';
  var trackPattern = /^#?\.[a-zA-Z0-9]{8,}/, interval;
  function removeHash(hsh) {
    var subst, idx;
    if (typeof hsh === 'symbol') hsh = '';
    hsh += '';
    idx = hsh.indexOf('#');
    if (idx !== -1) {
      subst = hsh.slice(idx);
      if (trackPattern.test(subst)) return hsh.slice(0, idx);
      else return hsh;
    } else return '';
  }
  function locHashRemover() {
    var hsh = location.hash;
    if (trackPattern.test(hsh)) location.hash = '';
    else {
      clearInterval(interval);
      interval = null;
    }
  }
  function removeHashes() {
    var links = document.getElementsByTagName('a'),
      forms = document.getElementsByTagName('form'), i;
    interval = interval || setInterval(locHashRemover, 16);
    for (i in links)
      if (links.hasOwnProperty(i))
        i.hash = removeHash(i.hash);
    for (i in forms)
      if(forms.hasOwnProperty(i))
        i.action = removeHash(i.action);
  }
  function dclRemover() {
    document.removeEventListener('DOMContentLoaded', dclRemover, false);
    removeHashes();
  }
  function loadRemover() {
    window.removeEventListener('load', loadRemover, false);
    removeHashes();
  }
  removeHashes();
  document.addEventListener('readystatechange', removeHashes, false);
  document.addEventListener('DOMContentLoaded', dclRemover, false);
  window.addEventListener('load', loadRemover, false);
  window.addEventListener('hashchange', removeHashes, false);
}(window));