feat: remove the indent from chinese punctuation

This commit is contained in:
Hakadao
2024-09-26 22:33:24 +08:00
parent a071be8b8f
commit ea083c527a
7 changed files with 54 additions and 6 deletions

View File

@@ -113,6 +113,10 @@ settings:
customize_font_desc: |-
对于喜欢旧字形的用户,我们推荐 <a href="https://github.com/GuiWonder/Shanggu" target="_blank">Shanggu Fonts (尚古字型)</a> 和 <a href="https://github.com/ayaka14732/FanWunHak" target="_blank">Fan Wun Hak (繁媛黑體)</a>。
这些字形还具有将简体中文转换为繁体/正体中文的能力。
remove_the_indent_from_chinese_punctuation: 移除中文标点符号的缩进
remove_the_indent_from_chinese_punctuation_desc: >
Bilibili 默认会专门处理中文标点符号以实现左对齐。
如果你正在使用自定义字体,建议移除缩进。
video_card_link_opening_behavior: 视频卡片和番剧卡片链接打开行为
video_card_link_opening_behavior_opt:

View File

@@ -113,6 +113,10 @@ settings:
customize_font_desc: |-
對於喜歡舊字形的用戶,我們推薦 <a href="https://github.com/GuiWonder/Shanggu" target="_blank">Shanggu Fonts (尚古字型)</a> 和 <a href="https://github.com/ayaka14732/FanWunHak" target="_blank">Fan Wun Hak (繁媛黑體)</a>。
這些字型還具有將簡體中文轉換為繁體/正體中文的能力。
remove_the_indent_from_chinese_punctuation: 移除中文標點符號的縮排
remove_the_indent_from_chinese_punctuation_desc: >
Bilibili 預設會特別處理中文標點符號以達到左對齊。
如果你正在使用自訂字型,建議移除縮排。
video_card_link_opening_behavior: 影片和番劇卡片連結開啟行為
video_card_link_opening_behavior_opt:

View File

@@ -113,6 +113,10 @@ settings:
customize_font_desc: |-
For users who favor the traditional style of Chinese characters, we recommend <a href="https://github.com/GuiWonder/Shanggu" target="_blank">Shanggu Fonts (尚古字體)</a> and <a href="https://github.com/ayaka14732/FanWunHak" target="_blank">Fan Wun Hak (繁媛黑體)</a>.
These fonts also possess the capability to convert simplified Chinese into traditional characters.
remove_the_indent_from_chinese_punctuation: Remove the indent from Chinese punctuation
remove_the_indent_from_chinese_punctuation_desc: >
By default, Bilibili will specifically handle Chinese punctuation to achieve left alignment.
If you are using a custom font, it is recommended to remove the indent.
video_card_link_opening_behavior: Video card and bangumi card link opening behavior
video_card_link_opening_behavior_opt:

View File

@@ -113,6 +113,9 @@ settings:
customize_font_desc: |-
對於舊字形嘅用戶,我哋推介 <a href="https://github.com/GuiWonder/Shanggu" target="_blank">Shanggu Fonts (尚古字型)</a> 同 <a href="https://github.com/ayaka14732/FanWunHak" target="_blank">Fan Wun Hak (繁媛黑體)</a>。
呢啲字型仲可以將簡體中文轉做繁體/正體中文。
remove_the_indent_from_chinese_punctuation: 移除中文標點符號嘅縮排
remove_the_indent_from_chinese_punctuation_desc: >
Bilibili 預設會專登執吓中文標點符號,令到佢可以左對齊。如果你係用緊自訂字字型,最好係移除縮排。
video_card_link_opening_behavior: 影片同番劇卡片連結開啓行爲
video_card_link_opening_behavior_opt:

View File

@@ -95,6 +95,9 @@ watch(() => settings.value.language, (newValue) => {
<div class="customize-font-desc" text="sm $bew-text-2" mt-1 v-html="t('settings.customize_font_desc')" />
</template>
</SettingsItem>
<SettingsItem :title="$t('settings.remove_the_indent_from_chinese_punctuation')" :desc="$t('settings.remove_the_indent_from_chinese_punctuation_desc')">
<Radio v-model="settings.removeTheIndentFromChinesePunctuation" />
</SettingsItem>
</SettingsItemGroup>
<SettingsItemGroup :title="$t('settings.group_performance')">

View File

@@ -67,6 +67,33 @@ export function setupNecessarySettingsWatchers() {
{ immediate: true },
)
const removeTheIndentFromChinesePunctuationStyleEl = injectCSS(`
.video-info-container .special-text-indent[data-title^='《'],
.video-info-container .special-text-indent[data-title^='「'],
.video-info-container .special-text-indent[data-title^='『'],
.video-info-container .special-text-indent[data-title^='【'],
p[title^='\\300c'],
p[title^='\\300e'],
p[title^='\\3010'],
h3[title^='\\300c'],
h3[title^='\\300e'],
h3[title^='\\3010'] {
text-indent: 0 !important;
}
`)
watch(
() => settings.value.removeTheIndentFromChinesePunctuation,
() => {
if (settings.value.removeTheIndentFromChinesePunctuation) {
document.documentElement.appendChild(removeTheIndentFromChinesePunctuationStyleEl)
}
else {
document.documentElement.removeChild(removeTheIndentFromChinesePunctuationStyleEl)
}
},
{ immediate: true },
)
watch(
() => settings.value.disableFrostedGlass,
() => {

View File

@@ -7,13 +7,14 @@ export const storageDemo = useStorageLocal('webext-demo', 'Storage Demo')
export const accessKey = useStorageLocal('accessKey', '')
export interface Settings {
language: string
customizeFont: boolean
fontFamily: string
touchScreenOptimization: boolean
enableGridLayoutSwitcher: boolean
enableHorizontalScrolling: boolean
language: string
customizeFont: boolean
fontFamily: string
removeTheIndentFromChinesePunctuation: boolean
disableFrostedGlass: boolean
reduceFrostedGlassBlur: boolean
@@ -89,13 +90,15 @@ export interface Settings {
}
export const originalSettings: Settings = {
language: '',
customizeFont: false,
fontFamily: '',
touchScreenOptimization: false,
enableGridLayoutSwitcher: true,
enableHorizontalScrolling: false,
language: '',
customizeFont: false,
fontFamily: '',
removeTheIndentFromChinesePunctuation: false,
disableFrostedGlass: true,
reduceFrostedGlassBlur: false,