mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
Update On Sat Feb 14 19:47:04 CET 2026
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["utils/url-params-clean"]=t():e["utils/url-params-clean"]=t()}(globalThis,(()=>(()=>{var e,t,r={620:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=620,e.exports=t},95:e=>{"use strict";e.exports="自动删除网址中的多余跟踪参数。请注意这会导致浏览器历史记录出现重复的标题(分别是转换前后的网址),并可能导致后退要多退几次。\n"},576:e=>{"use strict";e.exports=coreApis.lifeCycle},104:e=>{"use strict";e.exports=coreApis.observer}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var i=o[e]={exports:{}};return r[e](i,i.exports,a),i.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,o){if(1&o&&(r=this(r)),8&o)return r;if("object"==typeof r&&r){if(4&o&&r.__esModule)return r;if(16&o&&"function"==typeof r.then)return r}var i=Object.create(null);a.r(i);var n={};e=e||[null,t({}),t([]),t(t)];for(var s=2&o&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>n[e]=()=>r[e]));return n.default=()=>r,a.d(i,n),i},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";a.d(i,{component:()=>s});const e=coreApis.pluginApis.data,t=coreApis.componentApis.define,r=coreApis.utils,o="网址参数清理",n=(0,coreApis.utils.log.useScopedConsole)(o),s=(0,t.defineComponentMetadata)({name:"urlParamsClean",displayName:o,entry:async()=>{if((0,r.isNotHtml)()||(0,r.isIframe)())return;
|
||||
/* spell-checker: disable */const[t]=(0,e.registerAndGetData)("urlParamsClean.noClean",["videocard_series"]),[o]=(0,e.registerAndGetData)("urlParamsClean.params",["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","share_session_id","share_from","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom","visit_id","bsource","spm","hotRank","-Arouter","vd_source","is_story_h5","buvid","plat_id","goFrom","jumpLinkType","hasBack","noTitleBar","msource","live_from","plat_id","extra_jump_from","subarea_rank","popular_rank","launch_id","spmid","trackid","from_avid","from_comid"]),[i]=(0,e.registerAndGetData)("urlParamsClean.siteSpecifiedParams",[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"},{match:/\/\/live\.bilibili\.com\//,param:"session_id"},{match:/\/\/live\.bilibili\.com\//,param:"is_room_feed"},{match:/\/\/www\.bilibili\.com\/bangumi\//,param:"theme"},{match:/\/\/www\.bilibili\.com\/video\//,param:"mid"},{match:/\/\/www\.bilibili\.com\/video\//,param:"up_id"},{match:/\/\/mall\.bilibili\.com\//,param:"noReffer"}]),[s]=(0,e.registerAndGetData)("urlParamsClean.tailingSlash",[]),l=e=>{const a=new URL(e,location.origin),n=[...new URLSearchParams(a.search).entries()].map((e=>{let[t,r]=e;return`${t}=${encodeURIComponent(r)}`}));if(n.some((e=>t.some((t=>e.includes(t))))))return e;const l=n.filter((e=>!o.some((t=>e.startsWith(`${t}=`)))&&!i.some((t=>{let{match:r,param:o}=t;return document.URL.match(r)&&e.startsWith(`${o}=`)})))).join("&");s.forEach((e=>{let{match:t}=e;const o=a.pathname;(0,r.matchPattern)(o,t)&&o.endsWith("/")&&(a.pathname=o.slice(0,o.length-1))}));const c=l?`?${l}`:"";return a.search=c,a.toString()},c=e=>function(t,r,o){for(var a=arguments.length,i=new Array(a>3?a-3:0),s=3;s<a;s++)i[s-3]=arguments[s];if(null==o)return e.call(this,t,r,o,...i);const c=(()=>{try{return new URL(o,location.origin+location.pathname).toString()}catch(e){return n.warn("History API URL",`解析失败: ${o}`),o}})(),m=l(c);return m!==o?(n.log("History API 拦截",c,m),e.call(this,t,r,m,...i)):e.call(this,t,r,o,...i)},m=unsafeWindow.history.pushState;unsafeWindow.history.pushState=c(m);const u=unsafeWindow.history.replaceState;unsafeWindow.history.replaceState=c(u);const{fullyLoaded:p}=await Promise.resolve().then(a.t.bind(a,576,23)),{urlChange:d}=await Promise.resolve().then(a.t.bind(a,104,23));p((()=>{d((()=>(()=>{const e=l(document.URL);e!==document.URL&&(n.log("直接清理",document.URL,e),window.history.replaceState(history.state,"",e))})()))}))},tags:[componentsTags.utils],
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["utils/url-params-clean"]=t():e["utils/url-params-clean"]=t()}(globalThis,(()=>(()=>{var e,t,r={620:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=620,e.exports=t},95:e=>{"use strict";e.exports="自动删除网址中的多余跟踪参数。请注意这会导致浏览器历史记录出现重复的标题(分别是转换前后的网址),并可能导致后退要多退几次。\n\n- `清理页面中的 A 标签`: 清理视频简介、推荐列表、标签、评论中的链接。\n"},576:e=>{"use strict";e.exports=coreApis.lifeCycle},104:e=>{"use strict";e.exports=coreApis.observer}},a={};function o(e){var t=a[e];if(void 0!==t)return t.exports;var i=a[e]={exports:{}};return r[e](i,i.exports,o),i.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(r,a){if(1&a&&(r=this(r)),8&a)return r;if("object"==typeof r&&r){if(4&a&&r.__esModule)return r;if(16&a&&"function"==typeof r.then)return r}var i=Object.create(null);o.r(i);var n={};e=e||[null,t({}),t([]),t(t)];for(var s=2&a&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>n[e]=()=>r[e]));return n.default=()=>r,o.d(i,n),i},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";o.d(i,{component:()=>b,k:()=>f});const e=coreApis.componentApis.define,t=coreApis.settings,r=coreApis.utils,a=coreApis.utils.log,n=coreApis.pluginApis.data,s=coreApis.componentApis.utils.commentApis;var c=o(576);const l=coreApis.shadowRoot,d=async(e,t,r)=>{if(e){new MutationObserver(((e,t)=>e.forEach((e=>r(e,t))))).observe(e,t)}},m={attributes:!0,attributeFilter:["href"],childList:!0,subtree:!0,characterData:!1},u="网址参数清理",p="urlParamsClean",f=(0,a.useScopedConsole)(u),h=(0,e.defineOptionsMetadata)({cleanAnchors:{defaultValue:!0,displayName:"清理页面中的 A 标签"}}),b=(0,e.defineComponentMetadata)({name:p,displayName:u,entry:async()=>{if((0,r.isNotHtml)()||(0,r.isIframe)())return;
|
||||
/* spell-checker: disable */const[e]=(0,n.registerAndGetData)("urlParamsClean.noClean",["videocard_series"]),[a]=(0,n.registerAndGetData)("urlParamsClean.params",["spm_id_from","from_source","from_spmid","from","seid","share_source","share_medium","share_plat","share_tag","share_session_id","share_from","bbid","ts","timestamp","unique_k","rt","tdsourcetag","accept_quality","broadcast_type","current_qn","current_quality","playurl_h264","playurl_h265","quality_description","network","network_status","platform_network_status","p2p_type","referfrom","visit_id","bsource","spm","hotRank","-Arouter","vd_source","is_story_h5","buvid","plat_id","goFrom","jumpLinkType","hasBack","noTitleBar","msource","live_from","plat_id","extra_jump_from","subarea_rank","popular_rank","launch_id","spmid","trackid","from_avid","from_comid"]),[i]=(0,n.registerAndGetData)("urlParamsClean.siteSpecifiedParams",[{match:/\/\/www\.bilibili\.com\/audio\/(au[\d]+|mycollection)/,param:"type"},{match:/\/\/live\.bilibili\.com\//,param:"session_id"},{match:/\/\/live\.bilibili\.com\//,param:"is_room_feed"},{match:/\/\/www\.bilibili\.com\/bangumi\//,param:"theme"},{match:/\/\/www\.bilibili\.com\/video\//,param:"mid"},{match:/\/\/www\.bilibili\.com\/video\//,param:"up_id"},{match:/\/\/mall\.bilibili\.com\//,param:"noReffer"}]),[u]=(0,n.registerAndGetData)("urlParamsClean.tailingSlash",[]),h=t=>{const o=new URL(t,location.origin),n=[...new URLSearchParams(o.search).entries()].map((e=>{let[t,r]=e;return`${t}=${encodeURIComponent(r)}`}));if(n.some((t=>e.some((e=>t.includes(e))))))return t;const s=n.filter((e=>!a.some((t=>e.startsWith(`${t}=`)))&&!i.some((t=>{let{match:r,param:a}=t;return document.URL.match(r)&&e.startsWith(`${a}=`)})))).join("&");u.forEach((e=>{let{match:t}=e;const a=o.pathname;(0,r.matchPattern)(a,t)&&a.endsWith("/")&&(o.pathname=a.slice(0,a.length-1))}));const c=s?`?${s}`:"";return o.search=c,o.toString()},b=e=>function(t,r,a){for(var o=arguments.length,i=new Array(o>3?o-3:0),n=3;n<o;n++)i[n-3]=arguments[n];if(null==a)return e.call(this,t,r,a,...i);const s=(()=>{try{return new URL(a,location.origin+location.pathname).toString()}catch(e){return f.warn("History API URL",`解析失败: ${a}`),a}})(),c=h(s);return c!==a?(f.log("History API 拦截",s,c),e.call(this,t,r,c,...i)):e.call(this,t,r,a,...i)},y=unsafeWindow.history.pushState;unsafeWindow.history.pushState=b(y);const _=unsafeWindow.history.replaceState;unsafeWindow.history.replaceState=b(_);(0,t.getComponentSettings)(p).options.cleanAnchors&&(async e=>{const t=t=>{if("A"!==t.nodeName||!t.href)return;const r=e(t.href);t.href!==r&&(f.info("清理A标签",t,t.href,r),t.href=r)},r=e=>{Array.from(e).forEach(t)},a=e=>{"href"===e.attributeName?t(e.target):e.addedNodes[0]&&e.addedNodes[0]instanceof HTMLElement&&r(e.addedNodes[0].querySelectorAll("a"))};(0,c.contentLoaded)((()=>{r(dqa(".tag-panel .tag-link")),d(dq(".tag-panel"),m,a),d(dq("#v_desc"),{childList:!0,subtree:!0,characterData:!1},(e=>{e.addedNodes.length>0&&e.target instanceof HTMLElement&&r(e.target.querySelectorAll("a"))})),r(dqa(".recommend-list-container a")),d(dq(".rcmd-tab,.recommend-list-container"),m,a),(0,s.forEachCommentArea)((async e=>{e instanceof s.CommentAreaV3&&e.commentAreaEntry.addEventListener(l.ShadowRootEvents.Updated,(e=>e.detail.forEach((e=>{e.addedNodes.forEach((e=>t(e)))}))))}))}))})(h);const{fullyLoaded:g}=await Promise.resolve().then(o.t.bind(o,576,23)),{urlChange:v}=await Promise.resolve().then(o.t.bind(o,104,23));g((()=>{v((()=>(()=>{const e=h(document.URL);e!==document.URL&&(f.log("直接清理",document.URL,e),window.history.replaceState(history.state,"",e))})()))}))},options:h,tags:[componentsTags.utils],
|
||||
/* spell-checker: disable */
|
||||
urlExclude:[/game\.bilibili\.com\/fgo/,/live\.bilibili\.com\/p\/html\/live-app-hotrank\//],commitHash:"f95c8249bc9604b55834ddd2fcfd2b140d2415aa",coreVersion:"2.10.5",description:(()=>{const e=a(620);return{...Object.fromEntries(e.keys().map((t=>[t.match(/index\.(.+)\.md$/)[1],e(t)]))),"zh-CN":()=>Promise.resolve().then(a.t.bind(a,95,17)).then((e=>e.default))}})()})})(),i=i.component})()));
|
||||
urlExclude:[/game\.bilibili\.com\/fgo/,/live\.bilibili\.com\/p\/html\/live-app-hotrank\//],commitHash:"b124322e4d91fcffe2a4f2eca77b05660bc84c3c",coreVersion:"2.10.6",description:(()=>{const e=o(620);return{...Object.fromEntries(e.keys().map((t=>[t.match(/index\.(.+)\.md$/)[1],e(t)]))),"zh-CN":()=>Promise.resolve().then(o.t.bind(o,95,17)).then((e=>e.default))}})()})})(),i=i.component})()));
|
||||
Reference in New Issue
Block a user