From 3e06c271b658b34bd0ca93fbdb90e64c2cb715d1 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 17 Mar 2024 21:13:06 +0800 Subject: [PATCH 1/2] chore: refactor some code implementations --- src/contentScripts/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 9dc566fb..b5e27929 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -68,20 +68,20 @@ function isSupportedPages() { let beforeLoadedStyleEl: HTMLStyleElement | undefined -// Since using runWhenIdle does not instantly inject the app to the page, a style class cannot be injected immediately to the tag -// We have to manually add a class to the app to ensure that the transition effect is applied -if ( - isSupportedPages() && ( +if (isSupportedPages()) { + // Since using runWhenIdle does not instantly inject the app to the page, a style class cannot be injected immediately to the tag + // We have to manually add a class to the app to ensure that the transition effect is applied + if ( (settings.value.adaptToOtherPageStyles && settings.value.theme === 'dark') || (settings.value.adaptToOtherPageStyles && window.matchMedia('(prefers-color-scheme: dark)').matches) ) -) - document.documentElement.classList.add('dark') + document.documentElement.classList.add('dark') -if (settings.value.adaptToOtherPageStyles) - document.documentElement.classList.add('bewly-design') -else - document.documentElement.classList.remove('bewly-design') + if (settings.value.adaptToOtherPageStyles) + document.documentElement.classList.add('bewly-design') + else + document.documentElement.classList.remove('bewly-design') +} if (settings.value.adaptToOtherPageStyles && isHomePage()) { beforeLoadedStyleEl = injectCSS(` From 236be1c06c33d44e8cce66153b7ad8c69e34135b Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 17 Mar 2024 21:20:32 +0800 Subject: [PATCH 2/2] chore: change version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9796376..d2fc08ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bewly-bewly", "displayName": "BewlyBewly", - "version": "0.15.3", + "version": "0.15.4", "private": true, "packageManager": "pnpm@8.15.3", "description": "Just make a few small changes to your Bilibili homepage.",