aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/display-generator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/display-generator.js')
-rw-r--r--ext/mixed/js/display-generator.js32
1 files changed, 23 insertions, 9 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index 82f6199b..1810000b 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -80,7 +80,7 @@ class DisplayGenerator {
this._appendMultiple(expressionsContainer, this._createTermExpression.bind(this), expressions);
this._appendMultiple(reasonsContainer, this._createTermReason.bind(this), reasons);
- this._appendMultiple(frequenciesContainer, this._createFrequencyTag.bind(this), frequencies);
+ this._appendMultiple(frequenciesContainer, this._createTermFrequencyTag.bind(this), frequencies);
this._appendMultiple(pitchesContainer, this._createPitches.bind(this), pitches);
this._appendMultiple(definitionsContainer, this._createTermDefinitionItem.bind(this), definitions);
@@ -103,7 +103,7 @@ class DisplayGenerator {
glyphContainer.textContent = details.character;
- this._appendMultiple(frequenciesContainer, this._createFrequencyTag.bind(this), details.frequencies);
+ this._appendMultiple(frequenciesContainer, this._createKanjiFrequencyTag.bind(this), details.frequencies);
this._appendMultiple(tagContainer, this._createTag.bind(this), details.tags);
this._appendMultiple(glossaryContainer, this._createKanjiGlossaryItem.bind(this), details.glossary);
this._appendMultiple(chineseReadingsContainer, this._createKanjiReading.bind(this), details.onyomi);
@@ -138,7 +138,7 @@ class DisplayGenerator {
this._appendFurigana(expressionContainer, furiganaSegments, this._appendKanjiLinks.bind(this));
this._appendMultiple(tagContainer, this._createTag.bind(this), termTags);
this._appendMultiple(tagContainer, this._createSearchTag.bind(this), searchQueries);
- this._appendMultiple(frequencyContainer, this._createFrequencyTag.bind(this), frequencies);
+ this._appendMultiple(frequencyContainer, this._createTermFrequencyTag.bind(this), frequencies);
return node;
}
@@ -458,14 +458,14 @@ class DisplayGenerator {
path.setAttribute('d', `M${pathPoints.join(' L')}`);
}
- _createFrequencyTag(details) {
+ _createTermFrequencyTag(details) {
const {expression, reading, dictionary, frequency} = details;
- const node = this._templates.instantiate('tag-frequency');
+ const node = this._templates.instantiate('term-tag-frequency');
- node.querySelector('.term-frequency-disambiguation-expression').textContent = expression;
- node.querySelector('.term-frequency-disambiguation-reading').textContent = reading;
- node.querySelector('.term-frequency-dictionary-name').textContent = dictionary;
- node.querySelector('.term-frequency-value').textContent = frequency;
+ node.querySelector('.tag-frequency-disambiguation-expression').textContent = expression;
+ node.querySelector('.tag-frequency-disambiguation-reading').textContent = reading;
+ node.querySelector('.tag-frequency-dictionary-name').textContent = dictionary;
+ node.querySelector('.tag-frequency-value').textContent = frequency;
node.dataset.expression = expression;
node.dataset.reading = reading;
@@ -476,6 +476,20 @@ class DisplayGenerator {
return node;
}
+ _createKanjiFrequencyTag(details) {
+ const {character, dictionary, frequency} = details;
+ const node = this._templates.instantiate('kanji-tag-frequency');
+
+ node.querySelector('.tag-frequency-dictionary-name').textContent = dictionary;
+ node.querySelector('.tag-frequency-value').textContent = frequency;
+
+ node.dataset.character = character;
+ node.dataset.dictionary = dictionary;
+ node.dataset.frequency = frequency;
+
+ return node;
+ }
+
_appendKanjiLinks(container, text) {
const jp = this._japaneseUtil;
let part = '';