From 2d29a485786bab7d9b6797e42e1d48ceee9b55eb Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 12 Jan 2025 22:15:19 +0800 Subject: [PATCH] fix: prevent style conflicts with `Bilibili Evolved` dark mode --- src/contentScripts/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 1a024b0f..e71b7029 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -128,10 +128,20 @@ if (isSupportedPages() || isSupportedIframePages()) { if (settings.value.adaptToOtherPageStyles) useDark() - if (settings.value.adaptToOtherPageStyles) + if (settings.value.adaptToOtherPageStyles) { document.documentElement.classList.add('bewly-design') - else + + // Remove the Bilibili Evolved's dark mode style + runWhenIdle(async () => { + const darkModeStyle = document.head.querySelector('#dark-mode') + if (darkModeStyle) + document.head.removeChild(darkModeStyle) + }) + } + + else { document.documentElement.classList.remove('bewly-design') + } } if (settings.value.adaptToOtherPageStyles && isHomePage()) {