mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat(settings): override danmaku font
This commit is contained in:
@@ -67,6 +67,38 @@ export function setupNecessarySettingsWatchers() {
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
let danmakuFontStyleEl: HTMLStyleElement | null = null
|
||||
watch(
|
||||
() => settings.value.overrideDanmakuFont,
|
||||
() => {
|
||||
let fallbackFontFamily = ''
|
||||
if (locale.value === LanguageType.Mandarin_CN) {
|
||||
fallbackFontFamily = 'var(--bew-fonts-mandarin-cn)'
|
||||
}
|
||||
else if (locale.value === LanguageType.Mandarin_TW) {
|
||||
fallbackFontFamily = 'var(--bew-fonts-mandarin-tw)'
|
||||
}
|
||||
else if (locale.value === LanguageType.Cantonese) {
|
||||
fallbackFontFamily = 'var(--bew-fonts-cantonese)'
|
||||
}
|
||||
else {
|
||||
fallbackFontFamily = 'var(--bew-fonts-english)'
|
||||
}
|
||||
|
||||
if (settings.value.overrideDanmakuFont) {
|
||||
danmakuFontStyleEl = injectCSS(`
|
||||
.bili-danmaku-x-dm {
|
||||
font-family: var(--bew-font-family, ${fallbackFontFamily}) !important;
|
||||
}
|
||||
`)
|
||||
}
|
||||
else {
|
||||
danmakuFontStyleEl?.remove()
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const removeTheIndentFromChinesePunctuationStyleEl = injectCSS(`
|
||||
.video-info-container .special-text-indent[data-title^='《'],
|
||||
.video-info-container .special-text-indent[data-title^='「'],
|
||||
|
||||
Reference in New Issue
Block a user