Split fbclid

Split fbclid when open link from facebook

当前为 2020-11-02 提交的版本,查看 最新版本

// ==UserScript==
// @name         Split fbclid
// @namespace    https://www.facebook.com/dung.dev.gramer/
// @version      0.3
// @description  Split fbclid when open link from facebook
// @author       DungGramer
// @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 ? decodeURIComponent(newURL[0]) : newURL[0].split(/\?/)[0];
    if(newURL[newURL.length - 1].match(/-\w+/) != null) {
      window.location = decodeURIComponent(newHref);
    } else {
        window.location = decodeURIComponent(newHref + newURL[newURL.length - 1]);
    }
})();