jakubste / Czyszczenie fb z długaśnych linków

// ==UserScript==
// @name         Czyszczenie fb z długaśnych linków
// @namespace    http://facebook.com/
// @version      0.1
// @description  Wkurzają mnie te długie linki jak je kopiuję
// @author       jakubste.pl
// @match        *://*.facebook.com/*
// @grant        none
// @copyright 2018, jakubste (https://openuserjs.org//users/jakubste)
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  function czysciciel() {
    const gowno = document.getElementsByClassName('timestampContent')

    let elem, url, index;

    for (let i in gowno) {
      if (gowno.hasOwnProperty(i)) {
        elem = gowno[i]
        elem = elem.parentNode.parentNode
        if (elem) {
          url = elem.getAttribute('href')
          if (url) {
            index = url.indexOf('__xts__')
            if (index > 0) {
              url = url.substring(0, index)
              elem.setAttribute('href', url)
            }
          }
        }
      }
    }

  }

  setInterval(czysciciel, 5000)
  czysciciel()
})();