diff --git a/src/content-script/site-adapters/bilibili/index.mjs b/src/content-script/site-adapters/bilibili/index.mjs index 932db1fb..aa831b91 100644 --- a/src/content-script/site-adapters/bilibili/index.mjs +++ b/src/content-script/site-adapters/bilibili/index.mjs @@ -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 */ }