feat: 添加移除占位选项

This commit is contained in:
wsgh0202 2025-07-26 00:23:34 +08:00
parent b08f444fdc
commit d46ab3500b
No known key found for this signature in database
GPG Key ID: F9658C3FEDCF6979
3 changed files with 15 additions and 7 deletions

View File

@ -1,8 +1,7 @@
删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等. 删除站内的各种广告. 包括首页的推广模块, 手机 app 推荐, 视频页面右侧的广告等.
> 注意: 首页推广模块删除后留下空白区域是正常现象, 如果觉得怪可以开启 `占位文本` 选项.
- `保留活动横幅`: 保留视频页面的活动横幅. - `保留活动横幅`: 保留视频页面的活动横幅.
- `选项` - `选项`
- `占位文本`: 删除首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域. - `卡片占位`: 关闭时广告卡片将完全隐藏,后续的视频卡片会自动补上空缺位置
- `调试模式`: 用于查看是否正确屏蔽广告 - `占位文本`: 屏蔽首页推广模块的广告后显示"🚫已屏蔽广告"来替代空白区域.
- `调试模式`: 用于查看是否正确屏蔽广告,启用时将边框高亮广告卡片,同时其他屏蔽选项会失效

View File

@ -85,6 +85,10 @@ const entry: ComponentEntry = async ({ settings, metadata }) => {
export const component = wrapSwitchOptions({ export const component = wrapSwitchOptions({
name: 'removePromotionOptions', name: 'removePromotionOptions',
switches: { switches: {
showContainer: {
displayName: '卡片占位',
defaultValue: true,
},
showPlaceholder: { showPlaceholder: {
displayName: '占位文本', displayName: '占位文本',
defaultValue: true, defaultValue: true,

View File

@ -95,9 +95,9 @@ body:not(.preserve-feed-goods) .bili-dyn-content__orig__additional:has(.dyn-good
$switchPrefix: 'removePromotions-switch'; $switchPrefix: 'removePromotions-switch';
// 首页广告推广 // 首页广告推广
.bili-video-card__wrap:has(.bili-video-card__stats > :is(.bili-video-card__stats--text, svg)), .container > :is(.feed-card, .bili-feed-card):has(.bili-video-card__stats > :is(.bili-video-card__stats--text, svg)),
// 视频搜索页广告 // 视频搜索页广告
.bili-video-card__wrap:has(.bili-video-card__info--ad) { .video-list-item:has(.bili-video-card__info--ad) {
visibility: hidden; visibility: hidden;
pointer-events: none !important; pointer-events: none !important;
@ -128,7 +128,12 @@ $switchPrefix: 'removePromotions-switch';
} }
} }
body:not(.#{$switchPrefix}-showContainer) & {
display: none;
}
body.#{$switchPrefix}-debug & { body.#{$switchPrefix}-debug & {
display: unset;
visibility: visible; visibility: visible;
border: red 1px solid; border: red 1px solid;
} }