Skip to content

Commit

Permalink
improve #603
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Jan 25, 2024
1 parent dcd3415 commit 6e0cf8f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/content-script/site-adapters/bilibili/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
Expand Down

0 comments on commit 6e0cf8f

Please sign in to comment.