mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { defineComponentMetadata } from '@/components/define'
|
|
import { forEachFeedsCard, getVueData } from '@/components/feeds/api'
|
|
import { feedsUrls } from '@/core/utils/urls'
|
|
|
|
export const component = defineComponentMetadata({
|
|
name: 'legacyFeedsImageViewer',
|
|
displayName: '动态图片平铺展示',
|
|
tags: [componentsTags.feeds],
|
|
urlInclude: feedsUrls,
|
|
entry: () => {
|
|
forEachFeedsCard({
|
|
added: card => {
|
|
const vueData = getVueData(card.element)
|
|
|
|
// 普通动态
|
|
const path = 'data.modules.module_dynamic.major.opus.style'
|
|
const imageViewerStyle: number | null = lodash.get(vueData, path, null)
|
|
if (imageViewerStyle === 1) {
|
|
lodash.set(vueData, path, undefined)
|
|
return
|
|
}
|
|
|
|
// 动态详情
|
|
const modules = vueData?.data?.modules
|
|
if (Array.isArray(modules)) {
|
|
const moduleTop = modules.find(m => m.module_type === 'MODULE_TYPE_TOP')
|
|
const moduleContent = modules.find(m => m.module_type === 'MODULE_TYPE_CONTENT')
|
|
const album = moduleTop?.module_top?.display?.album
|
|
const paragraphs: any[] = moduleContent?.module_content?.paragraphs
|
|
if (album && paragraphs) {
|
|
modules.splice(modules.indexOf(moduleTop), 1)
|
|
paragraphs.push({
|
|
align: 0,
|
|
para_type: 2,
|
|
pic: {
|
|
pics: album.pics,
|
|
style: 1,
|
|
},
|
|
})
|
|
}
|
|
}
|
|
},
|
|
})
|
|
},
|
|
})
|