mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge pull request #4189 from lovelyCARDINAL/patch-0
feat: add url-params-cleaner for bilibili-mall
This commit is contained in:
commit
726089d2a3
@ -49,6 +49,11 @@ const entry = async () => {
|
||||
'vd_source',
|
||||
'is_story_h5',
|
||||
'buvid',
|
||||
'goFrom',
|
||||
'jumpLinkType',
|
||||
'hasBack',
|
||||
'noTitleBar',
|
||||
'msource',
|
||||
]
|
||||
const [blockParams] = registerAndGetData('urlParamsClean.params', builtInBlockParams)
|
||||
const builtInSiteSpecifiedParams = [
|
||||
@ -72,6 +77,10 @@ const entry = async () => {
|
||||
match: /\/\/www\.bilibili\.com\/video\//,
|
||||
param: 'up_id',
|
||||
},
|
||||
{
|
||||
match: /\/\/mall\.bilibili\.com\//,
|
||||
param: 'noReffer',
|
||||
},
|
||||
]
|
||||
const [siteSpecifiedParams] = registerAndGetData(
|
||||
'urlParamsClean.siteSpecifiedParams',
|
||||
@ -81,7 +90,9 @@ const entry = async () => {
|
||||
const [tailingSlash] = registerAndGetData('urlParamsClean.tailingSlash', builtInTailingSlash)
|
||||
|
||||
const clean = () => {
|
||||
const urlParams = window.location.search.substring(1).split('&')
|
||||
const urlParams = [...new URLSearchParams(window.location.search).entries()].map(
|
||||
([key, value]) => `${key}=${value},`,
|
||||
)
|
||||
if (urlParams.some(param => noClean.some(it => param.includes(it)))) {
|
||||
return
|
||||
}
|
||||
@ -124,7 +135,7 @@ export const component = defineComponentMetadata({
|
||||
entry,
|
||||
description: {
|
||||
'zh-CN':
|
||||
'自动删除网址中的多余跟踪参数. 请注意这会导致浏览器历史记录出现重复的标题 (分别是转换前后的网址), 并可能导致后退要多退几次.',
|
||||
'自动删除网址中的多余跟踪参数。请注意这会导致浏览器历史记录出现重复的标题(分别是转换前后的网址),并可能导致后退要多退几次。',
|
||||
},
|
||||
tags: [componentsTags.utils],
|
||||
urlExclude: [/game\.bilibili\.com\/fgo/, /live\.bilibili\.com\/p\/html\/live-app-hotrank\//],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user