diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 8c664c93..17a19597 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -113,18 +113,23 @@ if (settings.value.adaptToOtherPageStyles && isHomePage()) { `) } -document.addEventListener('DOMContentLoaded', () => { - // Remove the original Bilibili homepage if in Bilibili homepage & useOriginalBilibiliHomepage is enabled +document.addEventListener('DOMContentLoaded', async () => { if (!settings.value.useOriginalBilibiliHomepage && isHomePage()) { - const originalTopBar = document.querySelector('#i_cecream > .bili-feed4 > .bili-header') - const originalTopBarInnerUselessContents = document.querySelectorAll('#i_cecream > .bili-feed4 > .bili-header > *:not(.bili-header__bar)') + const originalTopBar = document.querySelector('#i_cecream > .bili-feed4 > .bili-header') + const originalTopBarInnerUselessContents = document.querySelectorAll('#i_cecream > .bili-feed4 > .bili-header > *:not(.bili-header__bar)') + if (originalTopBar) { + // always show the background on the original bilibili top bar + originalTopBar.querySelector('.bili-header__bar')?.classList.add('slide-down') + } + + // Remove the original Bilibili homepage if in Bilibili homepage & useOriginalBilibiliHomepage is enabled document.body.innerHTML = '' - if (originalTopBar) - document.body.appendChild(originalTopBar) if (originalTopBarInnerUselessContents) originalTopBarInnerUselessContents.forEach(item => (item as HTMLElement).style.display = 'none') + if (originalTopBar) + document.body.appendChild(originalTopBar) } if (beforeLoadedStyleEl) document.documentElement.removeChild(beforeLoadedStyleEl) diff --git a/src/styles/adaptedStyles/common/topBar.scss b/src/styles/adaptedStyles/common/topBar.scss new file mode 100644 index 00000000..9886bd05 --- /dev/null +++ b/src/styles/adaptedStyles/common/topBar.scss @@ -0,0 +1,26 @@ +.bewly-design { + // Implement specific modifications to the page, like tweaking the layout, and place those styles here + .bili-header .slide-down, + .bili-header .mini-header { + background-color: var(--bew-elevated) !important; + backdrop-filter: var(--bew-filter-glass-1); + } + + // #region theme color adaption part + // Increase the priority of the style inside by writing a non-existent selector in `:not()` + :not(foobar) { + .bili-header .header-upload-entry { + background-color: var(--bew-theme-color); + } + + .bili-header .header-upload-entry:hover { + background-color: var(--bew-theme-color-80); + } + } + // #endregion + + // #region dark mode adaption part + // &.dark { + // } + // #endregion +} diff --git a/src/styles/adaptedStyles/index.ts b/src/styles/adaptedStyles/index.ts index d9ad6422..f31c5bbc 100644 --- a/src/styles/adaptedStyles/index.ts +++ b/src/styles/adaptedStyles/index.ts @@ -1,5 +1,6 @@ import './common/common.scss' import './common/comments.scss' +import './common/topBar.scss' import './common/footer.scss' import './common/modal.scss' import './common/btn.scss' diff --git a/src/styles/adaptedStyles/pages/homePage.scss b/src/styles/adaptedStyles/pages/homePage.scss index aadf1645..39dbe003 100644 --- a/src/styles/adaptedStyles/pages/homePage.scss +++ b/src/styles/adaptedStyles/pages/homePage.scss @@ -1,9 +1,3 @@ -.homePage { - .bili-header { - background-color: transparent; - } -} - .bewly-design.homePage { .header-channel { // margin-top: 10px; diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 91e68233..479ad234 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -333,7 +333,7 @@ --graph_white: var(--bew-content-solid); --graph_bg_thin: var(--bew-content-solid); --graph_bg_regular: var(--bew-content-solid); - --graph_bg_thick: var(--bew-elevated-solid); + --graph_bg_thick: color-mix(in oklab, var(--bew-content-solid), #fff 20%); --graph_weak: var(--Ga3); --graph_medium: var(--Ga5); --graph_icon: var(--Ga7);