From 1364fa1269ca9edef56c3920e664008f5670180e Mon Sep 17 00:00:00 2001 From: Hakadao Date: Wed, 10 Jul 2024 15:55:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20dark=20mode=20support=20for=20acc?= =?UTF-8?q?ount=20settings=20page(=E5=B8=B3=E8=99=9F=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E9=A0=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contentScripts/index.ts | 4 +- src/manifest.ts | 1 + .../adaptedStyles/accountSettingsPage.scss | 41 +++++++++++++++++++ src/styles/adaptedStyles/index.ts | 5 +++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/styles/adaptedStyles/accountSettingsPage.scss diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 514b93b7..8ce32997 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -67,8 +67,10 @@ function isSupportedPages() { || /https?:\/\/(?:www\.)?bilibili\.com\/read\/(?!pcpreview).*/.test(currentUrl) // 404 page || /^https?:\/\/(?:www\.)?bilibili\.com\/404.*$/.test(currentUrl) - // creative center page + // creative center page 創作中心頁 || /^https?:\/\/member\.bilibili\.com\/platform.*$/.test(currentUrl) + // account settings page 帳號中心頁 + || /^https?:\/\/account\.bilibili\.com\/.*$/.test(currentUrl) ) { return true } diff --git a/src/manifest.ts b/src/manifest.ts index 0ef7a04f..3092b5c6 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -53,6 +53,7 @@ export async function getManifest() { '*://space.bilibili.com/*', '*://message.bilibili.com/*', '*://member.bilibili.com/*', + '*://account.bilibili.com/*', '*://www.hdslb.com/*', ], js: ['./dist/contentScripts/index.global.js'], diff --git a/src/styles/adaptedStyles/accountSettingsPage.scss b/src/styles/adaptedStyles/accountSettingsPage.scss new file mode 100644 index 00000000..5996b77e --- /dev/null +++ b/src/styles/adaptedStyles/accountSettingsPage.scss @@ -0,0 +1,41 @@ +.bewly-design.accountSettingsPage { + // #region theme color adaption part + // Increase the priority of the style inside by writing a non-existent selector in `:not()` + :not(foobar) { + // do nothing.. + } + // #endregion + + // #region dark mode adaption part + &.dark { + .top-img, + .top_bg { + filter: invert(1) hue-rotate(180deg); + } + + .security_content { + filter: invert(0.98) hue-rotate(180deg) brightness(1.1); + + img, + video, + iframe, + [style*="background-image: url"], + [style*="background: url"], + .invitation-img { + filter: invert(0.98) hue-rotate(180deg) brightness(1.1); + } + } + + .mp-img { + background-color: black; + } + + .xts, + .table-normal *, + .record-login-descript, + .black-btn:not(:hover) { + color: black; + } + } + // #endregion +} diff --git a/src/styles/adaptedStyles/index.ts b/src/styles/adaptedStyles/index.ts index 31c19655..357e666a 100644 --- a/src/styles/adaptedStyles/index.ts +++ b/src/styles/adaptedStyles/index.ts @@ -133,6 +133,11 @@ async function setupStyles() { // }) // }) } + // account settings page + else if (/^https?:\/\/account\.bilibili\.com\/.*$/.test(currentUrl)) { + await import('./accountSettingsPage.scss') + document.documentElement.classList.add('accountSettingsPage') + } } setupStyles()