feat: 添加debug选项

This commit is contained in:
wsgh0202 2025-07-25 19:01:45 +08:00
parent 6fe8acfe1f
commit 4ec6faec2b
No known key found for this signature in database
GPG Key ID: F9658C3FEDCF6979
3 changed files with 26 additions and 3 deletions

View File

@ -1,4 +1,7 @@
删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等. 注意: 首页推广模块删除后留下空白区域是正常现象, 如果觉得怪可以开启 \`占位文本\` 选项.
删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等.
- \`占位文本\`: 删除首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域.
- \`保留活动横幅\`: 保留视频页面的活动横幅.
>注意: 首页推广模块删除后留下空白区域是正常现象, 如果觉得怪可以开启 `占位文本` 选项.
- `占位文本`: 删除首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域.
- `保留活动横幅`: 保留视频页面的活动横幅.
- `debug`: 调试模式,用于查看是否正确屏蔽广告

View File

@ -88,6 +88,13 @@ const entry: ComponentEntry = async ({ settings, metadata }) => {
},
true,
)
addComponentListener(
`${metadata.name}.debug`,
(value: boolean) => {
document.body.classList.toggle('debug', value)
},
true,
)
}
export const component = defineComponentMetadata({
name: 'removePromotions',
@ -113,5 +120,9 @@ export const component = defineComponentMetadata({
displayName: '保留动态商品推荐',
defaultValue: false,
},
debug: {
displayName: 'debug',
defaultValue: false,
},
},
})

View File

@ -117,5 +117,14 @@ body:not(.preserve-feed-goods) .bili-dyn-content__orig__additional:has(.dyn-good
body.promotion-show-placeholder & {
visibility: visible;
}
body.debug & {
visibility: hidden !important;
}
}
body.debug & {
visibility: visible;
border: red 1px solid;
}
}