diff --git a/registry/lib/components/utils/remove-promotions/index.md b/registry/lib/components/utils/remove-promotions/index.md index 20824b933..ea2c748f1 100644 --- a/registry/lib/components/utils/remove-promotions/index.md +++ b/registry/lib/components/utils/remove-promotions/index.md @@ -1,4 +1,7 @@ -删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等. 注意: 首页推广模块删除后留下空白区域是正常现象, 如果觉得怪可以开启 \`占位文本\` 选项. +删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等. -- \`占位文本\`: 删除首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域. -- \`保留活动横幅\`: 保留视频页面的活动横幅. +>注意: 首页推广模块删除后留下空白区域是正常现象, 如果觉得怪可以开启 `占位文本` 选项. + +- `占位文本`: 删除首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域. +- `保留活动横幅`: 保留视频页面的活动横幅. +- `debug`: 调试模式,用于查看是否正确屏蔽广告 diff --git a/registry/lib/components/utils/remove-promotions/index.ts b/registry/lib/components/utils/remove-promotions/index.ts index f8d3662a2..e06aa7ef4 100644 --- a/registry/lib/components/utils/remove-promotions/index.ts +++ b/registry/lib/components/utils/remove-promotions/index.ts @@ -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, + }, }, }) diff --git a/registry/lib/components/utils/remove-promotions/remove-promotions.scss b/registry/lib/components/utils/remove-promotions/remove-promotions.scss index 2b2e711dd..ee3a6c667 100644 --- a/registry/lib/components/utils/remove-promotions/remove-promotions.scss +++ b/registry/lib/components/utils/remove-promotions/remove-promotions.scss @@ -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; } }