Skip to content

Commit cf59ad8

Browse files
committed
block HarmonyOS Sans
1 parent ecae658 commit cf59ad8

5 files changed

Lines changed: 53 additions & 21 deletions

File tree

assets/block-harmonyos-sans.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[
2+
{
3+
"id": 1,
4+
"priority": 1,
5+
"action": { "type": "block" },
6+
"condition": {
7+
"urlFilter": "||s1.hdslb.com/bfs/static/jinkela/long/font/regular.css",
8+
"resourceTypes": ["stylesheet"]
9+
}
10+
},
11+
{
12+
"id": 2,
13+
"priority": 1,
14+
"action": { "type": "block" },
15+
"condition": {
16+
"urlFilter": "||s1.hdslb.com/bfs/static/jinkela/long/font/medium.css",
17+
"resourceTypes": ["stylesheet"]
18+
}
19+
}
20+
]

src/contentScripts/views/App.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ provide<BewlyAppProvider>('BEWLY_APP', {
405405
haveScrollbar,
406406
})
407407
408+
document.querySelectorAll('link[rel="stylesheet"]').forEach((el) => {
409+
const link = el as HTMLLinkElement
410+
if (link.href.includes('regular.css') || link.href.includes('medium.css'))
411+
link.remove()
412+
})
413+
408414
/* Add 'BewlyInternalResource' suffix to prevent conflict with local fonts. */
409415
const fontStyles = document.createElement('style')
410416
fontStyles.textContent = `

src/contentScripts/views/necessarySettingsWatchers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ export function setupNecessarySettingsWatchers() {
124124
.video-info-container .special-text-indent[data-title^='《'],a[title^='《'],p[title^='《'],h3[title^='《'],
125125
.video-info-container .special-text-indent[data-title^='「'],a[title^='「'],p[title^='「'],h3[title^='「'],
126126
.video-info-container .special-text-indent[data-title^='『'],a[title^='『'],p[title^='『'],h3[title^='『'],
127-
.video-info-container .special-text-indent[data-title^='【'],a[title^='【'],p[title^='【'],h3[title^='【'] {
127+
.video-info-container .special-text-indent[data-title^='【'],a[title^='【'],p[title^='【'],h3[title^='【'],
128+
.bili-video-card__title[title^="「"],
129+
.bili-video-card__title[title^="『"],
130+
.bili-video-card__title[title^="【"] {
128131
text-indent: 0 !important;
129132
}
130133
`)

src/manifest.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,26 @@ export async function getManifest() {
8787
world: 'MAIN',
8888
},
8989
],
90+
91+
declarative_net_request: {
92+
rule_resources: [
93+
{
94+
id: 'block-harmonyos-sans',
95+
enabled: true,
96+
path: 'assets/block-harmonyos-sans.json',
97+
},
98+
...isFirefox
99+
? []
100+
: [
101+
{
102+
id: 'ruleset_1',
103+
enabled: true,
104+
path: 'assets/rules.json',
105+
},
106+
],
107+
],
108+
},
109+
90110
web_accessible_resources: [
91111
{
92112
resources: ['dist/contentScripts/style.css', 'assets/*'],
@@ -104,19 +124,6 @@ export async function getManifest() {
104124
? `script-src 'self' http://localhost:${port}; object-src 'self' http://localhost:${port}`
105125
: 'script-src \'self\'; object-src \'self\'',
106126
},
107-
...isFirefox
108-
? {}
109-
: {
110-
declarative_net_request: {
111-
rule_resources: [
112-
{
113-
id: 'ruleset_1',
114-
enabled: true,
115-
path: 'assets/rules.json',
116-
},
117-
],
118-
},
119-
},
120127
}
121128

122129
if (isDev)

src/styles/fonts.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
-apple-system, BlinkMacSystemFont, "Pretendard Std Variable", "Inter Variable", Inter, "Adwaita Sans", "Noto Sans",
77
"Roboto Flex", Roboto, "Segoe UI Variable", "Segoe UI";
88
--bew-fonts-fallback:
9-
sans-serif, ui-sans-serif, system-ui, "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Segoe UI Emoji",
10-
"Segoe UI Symbol", emoji;
9+
sans-serif, "Apple Color Emoji", "Twemoji Mozilla", "Noto Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
1110

1211
--bew-fonts-english: var(--bew-fonts-basic), var(--bew-fonts-fallback);
1312
--bew-fonts-mandarin-cn:
@@ -31,15 +30,12 @@
3130
.bewly-design {
3231
code,
3332
samp,
34-
pre {
33+
pre,
34+
kbd {
3535
/* SimSun, MingLiU, MS Gothic, and Gulim/Dotum will fuck the UI up, so we must explicitly specify Consolas */
3636
/* FUCK YOU MICROSOFT EAT SHIT AND DIE */
3737
font-family: "Google Sans Code", Consolas, monospace, sans-serif;
3838
}
39-
40-
kbd {
41-
font-family: var(--bew-font-family);
42-
}
4339
}
4440

4541
:lang(en) .bewly-wrapper,

0 commit comments

Comments
 (0)