Bilibili-Evolved/min/url-params-clean.min.js
2020-03-05 11:51:50 +08:00

1 line
581 B
JavaScript

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