Bilibili-Evolved/min/url-params-clean.min.js
2020-04-08 15:42:21 +08:00

1 line
712 B
JavaScript

(()=>{return(t,e)=>{const s=["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","bbid","ts","timestamp","unique_k","rt","tdsourcetag"];const o=[/game\.bilibili\.com\/fgo/];const r=t=>{return t.endsWith("/")&&o.every(e=>!e.test(t))?_.trimEnd(t,"/"):t};const n=()=>{const t=location.search.substring(1).split("&");const e=t.filter(t=>{if(s.some(e=>t.startsWith(`${e}=`))){return false}return true});const o=e.join("&");const n=r(document.URL.replace(location.search,""));const c=o?"?"+o:"";const i=n+c;if(i!==document.URL){console.log("[URL params clean]",document.URL,i);history.replaceState({},document.title,i)}};n();Observer.videoChange(()=>n())}})();