您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Remove tracking elements from links
当前为
// ==UserScript== // @name Link Untracker // @namespace IzzySoft // @description Remove tracking elements from links // @license CC BY-NC-SA // @include * // @exclude *phpmyadmin* // @version 4 // @grant unsafeWindow // ==/UserScript== var badp = ['utm_','wt_','WT.','referrer']; /* we strip parameters starting with that */ var anch = ''; var replace_semicolon = true; /* some sites use ";" to separate URL params; URLSearchParams can't deal with that and messes up. If those sites don't work with "&", either set this to "false" or add that site on the exclude list */ for(var i = 0; i < document.links.length; i++) { var elem = document.links[i]; if (elem.search == '') continue; if (replace_semicolon) var purl = new URLSearchParams(elem.search.replace(new RegExp(';','g'),'&')); else var purl = new URLSearchParams(elem.search); for (let b of badp) { purl.delete(b); } if (elem.href.indexOf('#') > 0) anch = '#' + elem.href.split('#')[1]; else anch = ''; elem.href = elem.href.split('?')[0] + '?' + purl.toString() + anch; }