Add standalone reading (#1448)
* Add option * Update display * Hide redundant readings * Improve label and description
This commit is contained in:
parent
9e7a76a1f1
commit
1a7c264165
@ -25,6 +25,8 @@
|
|||||||
--disambiguation-separator: ', ';
|
--disambiguation-separator: ', ';
|
||||||
--disambiguation-reading-separator: ':';
|
--disambiguation-reading-separator: ':';
|
||||||
|
|
||||||
|
--expression-separator: '\3001';
|
||||||
|
|
||||||
/* Layout */
|
/* Layout */
|
||||||
--font-size-no-units: 14;
|
--font-size-no-units: 14;
|
||||||
--font-size: calc(1px * var(--font-size-no-units));
|
--font-size: calc(1px * var(--font-size-no-units));
|
||||||
@ -32,6 +34,9 @@
|
|||||||
--query-parser-font-size: calc(1em * var(--query-parser-font-size-no-units));
|
--query-parser-font-size: calc(1em * var(--query-parser-font-size-no-units));
|
||||||
--expression-font-size-no-units: 2;
|
--expression-font-size-no-units: 2;
|
||||||
--expression-font-size: calc(1em * var(--expression-font-size-no-units));
|
--expression-font-size: calc(1em * var(--expression-font-size-no-units));
|
||||||
|
--expression-reading-font-size-scale: 0.75;
|
||||||
|
--expression-reading-font-size: calc(var(--expression-reading-font-size-scale) * var(--expression-font-size));
|
||||||
|
--expression-reading-space: 0.5em;
|
||||||
--h2-font-size-no-units: 1.25;
|
--h2-font-size-no-units: 1.25;
|
||||||
--h2-font-size: calc(1em * var(--h2-font-size-no-units));
|
--h2-font-size: calc(1em * var(--h2-font-size-no-units));
|
||||||
|
|
||||||
@ -790,18 +795,41 @@ button.action-button[data-icon=source-term]::before {
|
|||||||
}
|
}
|
||||||
.term-expression-text-container {
|
.term-expression-text-container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
margin-left: calc(-1 * var(--expression-reading-space));
|
||||||
|
}
|
||||||
|
.term-expression-text-outer {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
margin-left: var(--expression-reading-space);
|
||||||
|
}
|
||||||
|
.term-expression-reading-outer {
|
||||||
|
display: none;
|
||||||
|
position: relative;
|
||||||
|
margin-left: var(--expression-reading-space);
|
||||||
}
|
}
|
||||||
.term-expression-text {
|
.term-expression-text {
|
||||||
color: var(--kanji-text-color);
|
color: var(--kanji-text-color);
|
||||||
font-size: var(--expression-font-size);
|
font-size: var(--expression-font-size);
|
||||||
display: inline-block;
|
}
|
||||||
position: relative;
|
.term-expression-reading {
|
||||||
|
color: var(--kanji-text-color);
|
||||||
|
font-size: var(--expression-reading-font-size);
|
||||||
|
}
|
||||||
|
.term-expression-list>.term-expression:not(:last-of-type)>.term-expression-text-container>.term-expression-text-outer::after {
|
||||||
|
content: var(--expression-separator);
|
||||||
|
font-size: var(--expression-font-size);
|
||||||
|
}
|
||||||
|
.term-expression-list>.term-expression:not(:last-of-type)>.term-expression-text-container>.term-expression-reading-outer::after {
|
||||||
|
content: var(--expression-separator);
|
||||||
|
font-size: var(--expression-reading-font-size);
|
||||||
}
|
}
|
||||||
.entry[data-expression-multi=true] .term-expression[data-frequency=popular] .term-expression-text,
|
.entry[data-expression-multi=true] .term-expression[data-frequency=popular] .term-expression-text,
|
||||||
|
.entry[data-expression-multi=true] .term-expression[data-frequency=popular] .term-expression-reading,
|
||||||
.entry[data-expression-multi=true] .term-expression[data-frequency=popular] .kanji-link {
|
.entry[data-expression-multi=true] .term-expression[data-frequency=popular] .kanji-link {
|
||||||
color: var(--kanji-popular-text-color);
|
color: var(--kanji-popular-text-color);
|
||||||
}
|
}
|
||||||
.entry[data-expression-multi=true] .term-expression[data-frequency=rare] .term-expression-text,
|
.entry[data-expression-multi=true] .term-expression[data-frequency=rare] .term-expression-text,
|
||||||
|
.entry[data-expression-multi=true] .term-expression[data-frequency=rare] .term-expression-reading,
|
||||||
.entry[data-expression-multi=true] .term-expression[data-frequency=rare] .kanji-link {
|
.entry[data-expression-multi=true] .term-expression[data-frequency=rare] .kanji-link {
|
||||||
color: var(--kanji-rare-text-color);
|
color: var(--kanji-rare-text-color);
|
||||||
}
|
}
|
||||||
@ -842,9 +870,6 @@ button.action-button[data-icon=source-term]::before {
|
|||||||
.term-expression-details>.frequencies {
|
.term-expression-details>.frequencies {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.term-expression-list>.term-expression:not(:last-of-type)>.term-expression-text-container>.term-expression-text::after {
|
|
||||||
content: '\3001';
|
|
||||||
}
|
|
||||||
.term-details {
|
.term-details {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
@ -854,6 +879,25 @@ button.action-button[data-icon=source-term]::before {
|
|||||||
.entry[data-expression-multi=true] .term-details {
|
.entry[data-expression-multi=true] .term-details {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
:root[data-term-display-mode=ruby-and-reading] .term-expression-text-outer::after,
|
||||||
|
:root[data-term-display-mode=term-and-reading] .term-expression-text-outer::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
:root[data-term-display-mode=ruby-and-reading] .term-expression-reading-outer,
|
||||||
|
:root[data-term-display-mode=term-and-reading] .term-expression-reading-outer {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
:root[data-term-display-mode=ruby-and-reading] .term-expression[data-reading-is-same=true] .term-expression-text-outer::after,
|
||||||
|
:root[data-term-display-mode=term-and-reading] .term-expression[data-reading-is-same=true] .term-expression-text-outer::after {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
:root[data-term-display-mode=ruby-and-reading] .term-expression[data-reading-is-same=true] .term-expression-reading-outer,
|
||||||
|
:root[data-term-display-mode=term-and-reading] .term-expression[data-reading-is-same=true] .term-expression-reading-outer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
:root[data-term-display-mode=term-and-reading] .term-expression-text>ruby>rt {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Entry indicator */
|
/* Entry indicator */
|
||||||
|
@ -276,6 +276,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["tags", "tags-grouped", "split-tags", "split-tags-grouped", "inline-list", "list"],
|
"enum": ["tags", "tags-grouped", "split-tags", "split-tags-grouped", "inline-list", "list"],
|
||||||
"default": "split-tags-grouped"
|
"default": "split-tags-grouped"
|
||||||
|
},
|
||||||
|
"termDisplayMode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["ruby", "ruby-and-reading", "term-and-reading"],
|
||||||
|
"default": "ruby"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -35,9 +35,13 @@
|
|||||||
<div class="debug-info"><a class="debug-log-link">Log debug info to console</a></div>
|
<div class="debug-info"><a class="debug-log-link">Log debug info to console</a></div>
|
||||||
</div></template>
|
</div></template>
|
||||||
<template id="term-expression-template" data-remove-whitespace-text="true"><div class="term-expression">
|
<template id="term-expression-template" data-remove-whitespace-text="true"><div class="term-expression">
|
||||||
<div class="term-expression-text-container">
|
<div class="term-expression-text-container" lang="ja">
|
||||||
<span class="term-expression-text source-text">
|
<span class="term-expression-text-outer source-text">
|
||||||
<span class="term-expression-current-indicator"></span>
|
<span class="term-expression-current-indicator"></span>
|
||||||
|
<span class="term-expression-text"></span>
|
||||||
|
</span>
|
||||||
|
<span class="term-expression-reading-outer">
|
||||||
|
<span class="term-expression-reading"></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="term-expression-details">
|
<div class="term-expression-details">
|
||||||
|
@ -741,8 +741,10 @@ class OptionsUtil {
|
|||||||
_updateVersion9(options) {
|
_updateVersion9(options) {
|
||||||
// Version 9 changes:
|
// Version 9 changes:
|
||||||
// Added general.frequencyDisplayMode.
|
// Added general.frequencyDisplayMode.
|
||||||
|
// Added general.termDisplayMode.
|
||||||
for (const profile of options.profiles) {
|
for (const profile of options.profiles) {
|
||||||
profile.options.general.frequencyDisplayMode = 'split-tags-grouped';
|
profile.options.general.frequencyDisplayMode = 'split-tags-grouped';
|
||||||
|
profile.options.general.termDisplayMode = 'ruby';
|
||||||
}
|
}
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ class DisplayGenerator {
|
|||||||
node.dataset.readingIsSame = `${!reading || reading === expression}`;
|
node.dataset.readingIsSame = `${!reading || reading === expression}`;
|
||||||
node.dataset.frequency = termFrequency;
|
node.dataset.frequency = termFrequency;
|
||||||
|
|
||||||
expressionContainer.lang = 'ja';
|
this._setTextContent(node.querySelector('.term-expression-reading'), reading.length > 0 ? reading : expression);
|
||||||
|
|
||||||
this._appendFurigana(expressionContainer, furiganaSegments, this._appendKanjiLinks.bind(this));
|
this._appendFurigana(expressionContainer, furiganaSegments, this._appendKanjiLinks.bind(this));
|
||||||
this._appendMultiple(tagContainer, this._createTag.bind(this), termTags);
|
this._appendMultiple(tagContainer, this._createTag.bind(this), termTags);
|
||||||
|
@ -813,6 +813,7 @@ class Display extends EventDispatcher {
|
|||||||
data.glossaryLayoutMode = `${options.general.glossaryLayoutMode}`;
|
data.glossaryLayoutMode = `${options.general.glossaryLayoutMode}`;
|
||||||
data.compactTags = `${options.general.compactTags}`;
|
data.compactTags = `${options.general.compactTags}`;
|
||||||
data.frequencyDisplayMode = `${options.general.frequencyDisplayMode}`;
|
data.frequencyDisplayMode = `${options.general.frequencyDisplayMode}`;
|
||||||
|
data.termDisplayMode = `${options.general.termDisplayMode}`;
|
||||||
data.enableSearchTags = `${options.scanning.enableSearchTags}`;
|
data.enableSearchTags = `${options.scanning.enableSearchTags}`;
|
||||||
data.showPitchAccentDownstepNotation = `${options.general.showPitchAccentDownstepNotation}`;
|
data.showPitchAccentDownstepNotation = `${options.general.showPitchAccentDownstepNotation}`;
|
||||||
data.showPitchAccentPositionNotation = `${options.general.showPitchAccentPositionNotation}`;
|
data.showPitchAccentPositionNotation = `${options.general.showPitchAccentPositionNotation}`;
|
||||||
|
@ -677,6 +677,19 @@
|
|||||||
<label class="toggle"><input type="checkbox" data-setting="general.debugInfo"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
|
<label class="toggle"><input type="checkbox" data-setting="general.debugInfo"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
|
<div class="settings-item advanced-only"><div class="settings-item-inner">
|
||||||
|
<div class="settings-item-left">
|
||||||
|
<div class="settings-item-label">Term display style</div>
|
||||||
|
<div class="settings-item-description">Change how terms and their readings are displayed.</div>
|
||||||
|
</div>
|
||||||
|
<div class="settings-item-right">
|
||||||
|
<select data-setting="general.termDisplayMode">
|
||||||
|
<option value="ruby">Term furigana</option>
|
||||||
|
<option value="ruby-and-reading">Term furigana and reading</option>
|
||||||
|
<option value="term-and-reading">Raw term and reading</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div></div>
|
||||||
<div class="settings-item advanced-only"><div class="settings-item-inner">
|
<div class="settings-item advanced-only"><div class="settings-item-inner">
|
||||||
<div class="settings-item-left">
|
<div class="settings-item-left">
|
||||||
<div class="settings-item-label">Frequency display style</div>
|
<div class="settings-item-label">Frequency display style</div>
|
||||||
|
@ -295,7 +295,8 @@ function createProfileOptionsUpdatedTestData1() {
|
|||||||
popupCurrentIndicatorMode: 'triangle',
|
popupCurrentIndicatorMode: 'triangle',
|
||||||
popupActionBarVisibility: 'auto',
|
popupActionBarVisibility: 'auto',
|
||||||
popupActionBarLocation: 'top',
|
popupActionBarLocation: 'top',
|
||||||
frequencyDisplayMode: 'split-tags-grouped'
|
frequencyDisplayMode: 'split-tags-grouped',
|
||||||
|
termDisplayMode: 'ruby'
|
||||||
},
|
},
|
||||||
audio: {
|
audio: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user