fix: refactor Bilibili header visibility logic

This commit is contained in:
Hakadao
2025-01-26 07:44:56 +08:00
parent 764bb992e5
commit a75d02f0cd

View File

@@ -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()