Split fbclid when open link from facebook
目前為
// ==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]);
}
})();