mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-11 11:16:18 +08:00
improve bilibili video path detection
This commit is contained in:
@@ -6,10 +6,13 @@ export default {
|
||||
try {
|
||||
// B站页面是SSR的,如果插入过早,页面 js 检测到实际 Dom 和期望 Dom 不一致,会导致重新渲染
|
||||
await waitForElementToExistAndSelect('img.bili-avatar-img')
|
||||
let oldPath = location.pathname
|
||||
const getVideoPath = () =>
|
||||
location.pathname + `?p=${new URLSearchParams(location.search).get('p') || 1}`
|
||||
let oldPath = getVideoPath()
|
||||
const checkPathChange = async () => {
|
||||
if (location.pathname !== oldPath) {
|
||||
oldPath = location.pathname
|
||||
const newPath = getVideoPath()
|
||||
if (newPath !== oldPath) {
|
||||
oldPath = newPath
|
||||
mountComponent(config.bilibili, userConfig)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user