mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
commit
3a326532aa
@ -4,6 +4,7 @@ import { playerReady } from '@/core/utils'
|
|||||||
import { videoUrls } from '@/core/utils/urls'
|
import { videoUrls } from '@/core/utils/urls'
|
||||||
import { getVueData } from '@/components/feeds/api'
|
import { getVueData } from '@/components/feeds/api'
|
||||||
import { VideoInfo } from '@/components/video/video-info'
|
import { VideoInfo } from '@/components/video/video-info'
|
||||||
|
import { useScopedConsole } from '@/core/utils/log'
|
||||||
|
|
||||||
interface RecommendList extends Vue {
|
interface RecommendList extends Vue {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@ -15,35 +16,41 @@ interface RecommendList extends Vue {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
}[]
|
}[]
|
||||||
$children: VideoPageCard[]
|
$children: (RecommendList & VideoPageCard)[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VideoPageCard extends Vue {
|
interface VideoPageCard extends Vue {
|
||||||
name: string
|
name: string
|
||||||
title: string
|
title: string
|
||||||
|
// 组件添加元素,非b站自有元素
|
||||||
mark: boolean
|
mark: boolean
|
||||||
item: {
|
item: {
|
||||||
aid: string
|
aid: string
|
||||||
ctime: number
|
ctime: number
|
||||||
owner: {
|
owner: {
|
||||||
|
// 组件添加元素,非b站自有元素
|
||||||
mark: boolean
|
mark: boolean
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const displayName = '显示视频投稿时间'
|
||||||
|
const console = useScopedConsole(displayName)
|
||||||
export const component = defineComponentMetadata({
|
export const component = defineComponentMetadata({
|
||||||
author: { name: 'wisokey', link: 'https://github.com/wisokey' },
|
author: { name: 'wisokey', link: 'https://github.com/wisokey' },
|
||||||
name: 'showUploadTime',
|
name: 'showUploadTime',
|
||||||
displayName: '显示视频投稿时间',
|
displayName,
|
||||||
description: '为视频播放页面的推荐列表中的视频添加显示视频投稿时间.',
|
description: '为视频播放页面的推荐列表中的视频添加显示视频投稿时间.',
|
||||||
tags: [componentsTags.video],
|
tags: [componentsTags.video],
|
||||||
urlInclude: videoUrls,
|
urlInclude: videoUrls,
|
||||||
entry: async () => {
|
entry: async () => {
|
||||||
const showUploadTime = (relist: VideoPageCard[]) => {
|
const showUploadTime = (relist: VideoPageCard[]) => {
|
||||||
relist.forEach(async video => {
|
relist.forEach(async video => {
|
||||||
|
// 确认存放推荐视频列表的List中的元素是否被更新
|
||||||
if (!video.item.owner.mark) {
|
if (!video.item.owner.mark) {
|
||||||
video.item.owner.mark = true
|
video.item.owner.mark = true
|
||||||
|
// 确认推荐视频卡片是否被更新
|
||||||
if (!video.mark) {
|
if (!video.mark) {
|
||||||
video.mark = true
|
video.mark = true
|
||||||
let createTime: Date
|
let createTime: Date
|
||||||
@ -58,22 +65,39 @@ export const component = defineComponentMetadata({
|
|||||||
createTime.getMonth() + 1
|
createTime.getMonth() + 1
|
||||||
}-${createTime.getDate()}`
|
}-${createTime.getDate()}`
|
||||||
}
|
}
|
||||||
|
// 保存生成后的name
|
||||||
video.item.owner.name = video.name
|
video.item.owner.name = video.name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getRecoList = () => {
|
||||||
|
const reco_list = dq('#reco_list')
|
||||||
|
let recoList: RecommendList = getVueData(reco_list)
|
||||||
|
if (recoList.isOpen === undefined) {
|
||||||
|
recoList = recoList.$children[0]
|
||||||
|
if (recoList.isOpen === undefined) {
|
||||||
|
console.log('结构获取失败')
|
||||||
|
console.log(document.URL)
|
||||||
|
console.log(recoList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return recoList
|
||||||
|
}
|
||||||
|
|
||||||
urlChange(async () => {
|
urlChange(async () => {
|
||||||
await playerReady()
|
await playerReady()
|
||||||
const relist: VideoPageCard[] = getVueData(dq('#reco_list')).$children.filter(
|
const recoList: RecommendList = getRecoList()
|
||||||
|
const relist: VideoPageCard[] = recoList.$children.filter(
|
||||||
video => video.$el.className.indexOf('special') === -1,
|
video => video.$el.className.indexOf('special') === -1,
|
||||||
)
|
)
|
||||||
showUploadTime(relist)
|
showUploadTime(relist)
|
||||||
})
|
})
|
||||||
|
|
||||||
await playerReady()
|
await playerReady()
|
||||||
|
// 监视推荐列表是否打开,如果打开则更新
|
||||||
childList(dq('#reco_list .rec-list'), async () => {
|
childList(dq('#reco_list .rec-list'), async () => {
|
||||||
const recoList: RecommendList = getVueData(dq('#reco_list'))
|
const recoList: RecommendList = getRecoList()
|
||||||
if (recoList.isOpen) {
|
if (recoList.isOpen) {
|
||||||
const relist: VideoPageCard[] = recoList.$children.filter(
|
const relist: VideoPageCard[] = recoList.$children.filter(
|
||||||
video => video.$el.className.indexOf('special') === -1,
|
video => video.$el.className.indexOf('special') === -1,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user