mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Add hide goods plugin (#4425)
This commit is contained in:
parent
ccab2cac68
commit
a6d2d77435
1
registry/lib/plugins/feeds/filter/hide-goods/index.md
Normal file
1
registry/lib/plugins/feeds/filter/hide-goods/index.md
Normal file
@ -0,0 +1 @@
|
||||
移除动态里的商品带货动态 (UP主的推荐 · 来自 XX), 装有 `动态过滤器` 时生效.
|
||||
24
registry/lib/plugins/feeds/filter/hide-goods/index.ts
Normal file
24
registry/lib/plugins/feeds/filter/hide-goods/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import type { PluginMetadata } from '@/plugins/plugin'
|
||||
|
||||
export const plugin: PluginMetadata = {
|
||||
name: 'feedsFilter.pluginBlocks.goods',
|
||||
displayName: '动态过滤器 - 移除商品带货动态',
|
||||
async setup() {
|
||||
const { forEachFeedsCard, getVueData } = await import('@/components/feeds/api')
|
||||
forEachFeedsCard({
|
||||
added: card => {
|
||||
const vueData = getVueData(card.element)
|
||||
const additionalType: string | null = lodash.get(
|
||||
vueData,
|
||||
'data.modules.module_dynamic.additional.type',
|
||||
null,
|
||||
)
|
||||
const isGoods = additionalType === 'ADDITIONAL_TYPE_GOODS'
|
||||
if (!isGoods) {
|
||||
return
|
||||
}
|
||||
card.element.classList.add('plugin-block')
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user