Skip to content

Commit 87d4cfa

Browse files
committed
Fix #32
Assisted-by: Grok 4.5
1 parent 955d52b commit 87d4cfa

4 files changed

Lines changed: 144 additions & 1 deletion

File tree

src/contentScripts/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ if (isFirefox) {
3030

3131
const currentUrl = document.URL
3232

33+
function isFansMedalWallPage(): boolean {
34+
return /https?:\/\/live\.bilibili\.com\/p\/html\/live-fansmedal-wall.*/.test(currentUrl)
35+
}
36+
3337
function isSupportedPages(): boolean {
3438
if (isInIframe())
3539
return false
@@ -119,13 +123,18 @@ export function isSupportedIframePages(): boolean {
119123

120124
let beforeLoadedStyleEl: HTMLStyleElement | undefined
121125

122-
if (isSupportedPages() || isSupportedIframePages()) {
126+
const isStylesOnlyPage = isFansMedalWallPage()
127+
128+
if (isSupportedPages() || isSupportedIframePages() || isStylesOnlyPage) {
123129
if (settings.value.adaptToOtherPageStyles)
124130
useDark()
125131

126132
if (settings.value.adaptToOtherPageStyles) {
127133
document.documentElement.classList.add('bewly-design')
128134

135+
if (isStylesOnlyPage && settings.value.themeColor)
136+
document.documentElement.style.setProperty('--bew-theme-color', settings.value.themeColor)
137+
129138
// Remove the Bilibili Evolved's dark mode style
130139
runWhenIdle(async () => {
131140
const darkModeStyle = document.head.querySelector('#dark-mode')

src/manifest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export async function getManifest() {
5959
'*://www.hdslb.com/*',
6060
'*://passport.bilibili.com/*',
6161
'*://music.bilibili.com/*',
62+
'*://live.bilibili.com/p/html/live-fansmedal-wall/*',
6263
],
6364
js: ['./dist/contentScripts/index.global.js'],
6465
css: ['./dist/contentScripts/style.css'],
@@ -78,6 +79,7 @@ export async function getManifest() {
7879
'*://www.hdslb.com/*',
7980
'*://passport.bilibili.com/*',
8081
'*://music.bilibili.com/*',
82+
'*://live.bilibili.com/p/html/live-fansmedal-wall/*',
8183
],
8284
js: ['./dist/inject/index.js'],
8385
run_at: 'document_start',

src/styles/adaptedStyles/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ async function setupStyles() {
149149
await import('./pages/loginPage.scss')
150150
document.documentElement.classList.add('loginPage')
151151
}
152+
153+
else if (/https?:\/\/live\.bilibili\.com\/p\/html\/live-fansmedal-wall.*/.test(currentUrl)) {
154+
await import('./pages/fansMedalWallPage.scss')
155+
document.documentElement.classList.add('fansMedalWallPage')
156+
}
152157
}
153158

154159
setupStyles()
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
.bewly-design.fansMedalWallPage {
2+
// #region theme color adaption part
3+
:not(foobar) {
4+
.content .info .num .progress .blue,
5+
.content .btn {
6+
background-color: var(--bew-theme-color);
7+
}
8+
9+
.content.border,
10+
.border {
11+
border-color: var(--bew-theme-color) !important;
12+
}
13+
14+
.header .count span {
15+
color: var(--bew-theme-color);
16+
}
17+
18+
[data-v-1615c0aa]::-webkit-scrollbar-thumb:hover {
19+
background: var(--bew-theme-color);
20+
}
21+
}
22+
// #endregion
23+
24+
// #region dark mode adaption part
25+
&.dark {
26+
& {
27+
background: var(--bew-bg) !important;
28+
background-color: var(--bew-bg) !important;
29+
color: var(--bew-text-1);
30+
}
31+
32+
body,
33+
body #app,
34+
#app,
35+
#main,
36+
.container {
37+
background: var(--bew-bg) !important;
38+
background-color: var(--bew-bg) !important;
39+
color: var(--bew-text-1);
40+
}
41+
42+
.header .name,
43+
.medalList .emptyDes,
44+
.medalList .list p,
45+
.medalList .title .name,
46+
.curMedal .info .name,
47+
.content .info .limit .before,
48+
.manage .tip {
49+
color: var(--bew-text-1) !important;
50+
}
51+
52+
.content .info .centerCon .name,
53+
.content .info .name,
54+
.content .info .num,
55+
.decoration .content .anchor .nickname {
56+
color: var(--bew-text-2) !important;
57+
}
58+
59+
.header .count,
60+
.content .info .limit,
61+
.medalList .title .mount,
62+
.medalList .noList p,
63+
.noList p,
64+
.empty:after,
65+
.notWear:after,
66+
.setting .configItem .info-content .info,
67+
.configItem .info {
68+
color: var(--bew-text-3) !important;
69+
}
70+
71+
.header .face,
72+
.curMedal .face {
73+
border-color: var(--bew-border-color);
74+
}
75+
76+
.content {
77+
border-color: var(--bew-border-color) !important;
78+
background-color: var(--bew-content-solid);
79+
}
80+
81+
.content .info {
82+
background-image: linear-gradient(
83+
90deg,
84+
var(--bew-content-solid) 56%,
85+
color-mix(in oklab, var(--bew-theme-color), var(--bew-content-solid) 88%) 99%
86+
) !important;
87+
}
88+
89+
.content .info .num .progress {
90+
background-color: var(--bew-fill-2);
91+
}
92+
93+
.setting {
94+
background: var(--bew-bg) !important;
95+
}
96+
97+
.setting .configItem .manage:after,
98+
.decoration .content:after {
99+
background: var(--bew-border-color) !important;
100+
}
101+
102+
.medalList .title {
103+
border-color: var(--bew-border-color) !important;
104+
}
105+
106+
#medalNew .medal_list .medal_item {
107+
background: var(--bew-content-solid) !important;
108+
}
109+
110+
#medalNew .user_avatar {
111+
background-color: var(--bew-fill-1) !important;
112+
}
113+
114+
.decoration .benefits-bg:not(.guard-1):not(.guard-2):not(.guard-3) {
115+
background-image: linear-gradient(90deg, var(--bew-content-solid) 56%, var(--bew-fill-1) 99%) !important;
116+
}
117+
118+
.ztolayer-dialog .dialog-body {
119+
color: var(--bew-text-1);
120+
}
121+
122+
.ztolayer-dialog .dialog-title .title {
123+
color: var(--bew-theme-color);
124+
}
125+
}
126+
// #endregion
127+
}

0 commit comments

Comments
 (0)