Split fbclid

Split fbclid when open link from facebook

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Split fbclid
// @author       DungGramer
// @version      1.2
// @description  Split fbclid when open link from facebook
// @homepage     https://greasyfork.org/en/scripts/415274-split-fbclid
// @namespace    https://www.facebook.com/dung.dev.gramer/
// @icon         https://www.flaticon.com/svg/static/icons/svg/889/889578.svg
// @include      /((&fbclid=\w+)|(fbclid=\w+))(-\w+|)/
// @grant        none
// ==/UserScript==

(function() {
    let newURL = window.location.href.split(/((&fbclid=\w+)|(fbclid=\w+))(-\w+|)/);
    let newHref = newURL[0].match(/\?\w+/) != null ? newURL[0] : newURL[0].split(/\?/)[0];
    if(newURL[newURL.length - 1].match(/-\w+/) != null) {
        history.replaceState(null, '', newHref);
    } else {
         history.replaceState(null, '', newHref + newURL[newURL.length - 1]);
    }
})();