Add hide goods plugin (#4425)

This commit is contained in:
the1812 2024-03-05 23:04:53 +08:00
parent ccab2cac68
commit a6d2d77435
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1 @@
移除动态里的商品带货动态 (UP主的推荐 · 来自 XX), 装有 `动态过滤器` 时生效.

View 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')
},
})
},
}