From 038d2a03484ad1e541ff117e085e15a2725d6197 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 3 Sep 2023 12:34:29 +0800 Subject: [PATCH] fix: correct topbar mask color inconsistency with homepage background --- src/components/Topbar/Topbar.vue | 14 +++++++++++++- src/contentScripts/views/App.vue | 10 +++++----- src/styles/variables.scss | 6 +++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/Topbar/Topbar.vue b/src/components/Topbar/Topbar.vue index e856888d..4d9bc3fb 100644 --- a/src/components/Topbar/Topbar.vue +++ b/src/components/Topbar/Topbar.vue @@ -42,6 +42,18 @@ const logo = ref() as Ref const avatarImg = ref() as Ref const avatarShadow = ref() as Ref +const isHomePage = computed(() => { + if ( + /https?:\/\/bilibili.com\/?$/.test(location.href) + || /https?:\/\/www.bilibili.com\/?$/.test(location.href) + || /https?:\/\/www.bilibili.com\/index.html$/.test(location.href) + || /https?:\/\/bilibili.com\/\?spm_id_from=.*/.test(location.href) + || /https?:\/\/www.bilibili.com\/\?spm_id_from=(.)*/.test(location.href) + ) + return true + return false +}) + watch( showNotificationsPop, (newVal, oldVal) => { @@ -198,7 +210,7 @@ async function getNewMomentsCount() { opacity="100" pointer-events-none z--1 - :style="{ background: settings.wallpaper ? 'linear-gradient(rgba(0,0,0,0.5), transparent)' : `linear-gradient(var(--bew-bg), transparent)` }" + :style="{ background: settings.wallpaper && isHomePage ? 'linear-gradient(rgba(0,0,0,0.5), transparent)' : `linear-gradient(var(--bew-homepage-bg), transparent)` }" /> diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 90a09c1b..b854cb2a 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -244,9 +244,9 @@ function setAppThemeColor() { function setAppWallpaperMaskingOpacity() { const bewlyElement = document.querySelector('#bewly') as HTMLElement if (settings.value.individuallySetSearchPageWallpaper && activatedPage.value === AppPage.Search) - bewlyElement.style.setProperty('--bew-bg-mask-opacity', `${settings.value.searchPageWallpaperMaskOpacity}%`) + bewlyElement.style.setProperty('--bew-homepage-bg-mask-opacity', `${settings.value.searchPageWallpaperMaskOpacity}%`) else - bewlyElement.style.setProperty('--bew-bg-mask-opacity', `${settings.value.wallpaperMaskOpacity}%`) + bewlyElement.style.setProperty('--bew-homepage-bg-mask-opacity', `${settings.value.wallpaperMaskOpacity}%`) } function handleRefresh() { @@ -273,7 +273,7 @@ function handleBackToTop() {