mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Detect cid on video collection pages
This commit is contained in:
parent
2e4137f940
commit
f7ce90935e
@ -75,7 +75,21 @@ export class Observer {
|
||||
})
|
||||
}
|
||||
static async videoChange (callback) {
|
||||
const cid = await SpinQuery.select(() => unsafeWindow.cid)
|
||||
const cid = await SpinQuery.select(() => {
|
||||
if (unsafeWindow.cid) {
|
||||
return unsafeWindow.cid
|
||||
}
|
||||
if (unsafeWindow.player?.getVideoMessage) {
|
||||
const info = unsafeWindow.player.getVideoMessage()
|
||||
if (Number.isNaN(info.cid)) {
|
||||
return null
|
||||
}
|
||||
if (!unsafeWindow.aid) {
|
||||
unsafeWindow.aid = info?.aid?.toString()
|
||||
}
|
||||
return info?.cid?.toString()
|
||||
}
|
||||
})
|
||||
if (cid === null) {
|
||||
return
|
||||
}
|
||||
@ -95,7 +109,7 @@ export class Observer {
|
||||
cidHooked = true
|
||||
}
|
||||
// callback();
|
||||
const videoContainer = await SpinQuery.select('#bilibili-player video')
|
||||
const videoContainer = await SpinQuery.select('.bilibili-player-video video')
|
||||
if (videoContainer) {
|
||||
Observer.childList(videoContainer, callback)
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user