This commit is contained in:
josc146
2024-01-25 17:31:28 +08:00
parent dcd341568f
commit 6e0cf8f3de
@@ -6,14 +6,14 @@ export default {
try {
// B站页面是SSR的,如果插入过早,页面 js 检测到实际 Dom 和期望 Dom 不一致,会导致重新渲染
await waitForElementToExistAndSelect('img.bili-avatar-img')
let oldUrl = location.href
const checkUrlChange = async () => {
if (location.href !== oldUrl) {
oldUrl = location.href
let oldPath = location.pathname
const checkPathChange = async () => {
if (location.pathname !== oldPath) {
oldPath = location.pathname
mountComponent(config.bilibili, userConfig)
}
}
window.setInterval(checkUrlChange, 500)
window.setInterval(checkPathChange, 500)
} catch (e) {
/* empty */
}