summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/mixed/js/display-generator.js92
1 files changed, 47 insertions, 45 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index c3817ab2..951f16ec 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -83,6 +83,53 @@ class DisplayGenerator {
return node;
}
+ createKanjiEntry(details) {
+ const node = this._templateHandler.instantiate('kanji-entry');
+
+ const glyphContainer = node.querySelector('.kanji-glyph');
+ const frequenciesContainer = node.querySelector('.frequencies');
+ const tagContainer = node.querySelector('.tags');
+ const glossaryContainer = node.querySelector('.kanji-glossary-list');
+ const chineseReadingsContainer = node.querySelector('.kanji-readings-chinese');
+ const japaneseReadingsContainer = node.querySelector('.kanji-readings-japanese');
+ const statisticsContainer = node.querySelector('.kanji-statistics');
+ const classificationsContainer = node.querySelector('.kanji-classifications');
+ const codepointsContainer = node.querySelector('.kanji-codepoints');
+ const dictionaryIndicesContainer = node.querySelector('.kanji-dictionary-indices');
+ const debugInfoContainer = node.querySelector('.debug-info');
+
+ if (glyphContainer !== null) {
+ glyphContainer.textContent = details.character;
+ }
+
+ this._appendMultiple(frequenciesContainer, this._createFrequencyTag.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);
+ this._appendMultiple(japaneseReadingsContainer, this._createKanjiReading.bind(this), details.kunyomi);
+
+ if (statisticsContainer !== null) {
+ statisticsContainer.appendChild(this._createKanjiInfoTable(details.stats.misc));
+ }
+ if (classificationsContainer !== null) {
+ classificationsContainer.appendChild(this._createKanjiInfoTable(details.stats.class));
+ }
+ if (codepointsContainer !== null) {
+ codepointsContainer.appendChild(this._createKanjiInfoTable(details.stats.code));
+ }
+ if (dictionaryIndicesContainer !== null) {
+ dictionaryIndicesContainer.appendChild(this._createKanjiInfoTable(details.stats.index));
+ }
+
+ if (debugInfoContainer !== null) {
+ debugInfoContainer.textContent = JSON.stringify(details, null, 4);
+ }
+
+ return node;
+ }
+
+ // Private
+
_createTermExpression([details, termTags]) {
const node = this._templateHandler.instantiate('term-expression');
@@ -165,51 +212,6 @@ class DisplayGenerator {
return node;
}
- createKanjiEntry(details) {
- const node = this._templateHandler.instantiate('kanji-entry');
-
- const glyphContainer = node.querySelector('.kanji-glyph');
- const frequenciesContainer = node.querySelector('.frequencies');
- const tagContainer = node.querySelector('.tags');
- const glossaryContainer = node.querySelector('.kanji-glossary-list');
- const chineseReadingsContainer = node.querySelector('.kanji-readings-chinese');
- const japaneseReadingsContainer = node.querySelector('.kanji-readings-japanese');
- const statisticsContainer = node.querySelector('.kanji-statistics');
- const classificationsContainer = node.querySelector('.kanji-classifications');
- const codepointsContainer = node.querySelector('.kanji-codepoints');
- const dictionaryIndicesContainer = node.querySelector('.kanji-dictionary-indices');
- const debugInfoContainer = node.querySelector('.debug-info');
-
- if (glyphContainer !== null) {
- glyphContainer.textContent = details.character;
- }
-
- this._appendMultiple(frequenciesContainer, this._createFrequencyTag.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);
- this._appendMultiple(japaneseReadingsContainer, this._createKanjiReading.bind(this), details.kunyomi);
-
- if (statisticsContainer !== null) {
- statisticsContainer.appendChild(this._createKanjiInfoTable(details.stats.misc));
- }
- if (classificationsContainer !== null) {
- classificationsContainer.appendChild(this._createKanjiInfoTable(details.stats.class));
- }
- if (codepointsContainer !== null) {
- codepointsContainer.appendChild(this._createKanjiInfoTable(details.stats.code));
- }
- if (dictionaryIndicesContainer !== null) {
- dictionaryIndicesContainer.appendChild(this._createKanjiInfoTable(details.stats.index));
- }
-
- if (debugInfoContainer !== null) {
- debugInfoContainer.textContent = JSON.stringify(details, null, 4);
- }
-
- return node;
- }
-
_createKanjiGlossaryItem(glossary) {
const node = this._templateHandler.instantiate('kanji-glossary-item');
const container = node.querySelector('.kanji-glossary');