diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 642ed7a5..a1b3a77c 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -124,17 +124,6 @@ watch( window.history.replaceState({}, '', url.toString()) } - // Remove the original Bilibili top bar when using original bilibili page to avoid two top bars showing - const biliHeader = document.querySelector('.bili-header') as HTMLElement | null - if (biliHeader && isSupportedIframePages()) { - if (settingsStore.getDockItemIsUseOriginalBiliPage(activatedPage.value) && !isInIframe()) { - biliHeader.style.visibility = 'hidden' - } - else { - biliHeader.style.visibility = 'visible' - } - } - if (scrollbarRef.value) { const osInstance = scrollbarRef.value.osInstance() osInstance.elements().viewport.scrollTop = 0 @@ -144,6 +133,19 @@ watch( { immediate: true }, ) +watch([() => showTopBar.value, () => activatedPage.value], () => { + // Remove the original Bilibili top bar when using original bilibili page to avoid two top bars showing + const biliHeader = document.querySelector('.bili-header') as HTMLElement | null + if (biliHeader && isHomePage()) { + if (settingsStore.getDockItemIsUseOriginalBiliPage(activatedPage.value) && !isInIframe()) { + biliHeader.style.visibility = 'hidden' + } + else { + biliHeader.style.visibility = 'visible' + } + } +}, { immediate: true }) + // Setup necessary settings watchers setupNecessarySettingsWatchers()