diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-03-06 15:53:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-06 15:53:45 -0500 |
commit | 16217728afe0f9ff7dcbb7c7b7ead454ccc8705f (patch) | |
tree | 126bc188bd675343ee4e796826177e14f6664094 /ext/js/display | |
parent | a65742a884223451324fcab5cfaeb6ebdfe32ec1 (diff) |
Improve empty reading handling (#1497)
* Handle empty readings earlier in the definition creation process
* Remove empty reading check
* Remove special handling of empty readings
Diffstat (limited to 'ext/js/display')
-rw-r--r-- | ext/js/display/display-generator.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 93e84bdd..d8ae566e 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -70,8 +70,7 @@ class DisplayGenerator { const uniqueExpressions = new Set(); const uniqueReadings = new Set(); - for (let {expression, reading} of expressions) { - if (reading.length === 0) { reading = expression; } + for (const {expression, reading} of expressions) { uniqueExpressions.add(expression); uniqueReadings.add(reading); } @@ -244,7 +243,7 @@ class DisplayGenerator { const expressionContainer = node.querySelector('.expression-text'); const tagContainer = node.querySelector('.expression-tag-list'); - node.dataset.readingIsSame = `${!reading || reading === expression}`; + node.dataset.readingIsSame = `${reading === expression}`; node.dataset.frequency = termFrequency; const pitchAccentCategories = this._getPitchAccentCategories(pitches); @@ -252,7 +251,7 @@ class DisplayGenerator { node.dataset.pitchAccentCategories = pitchAccentCategories; } - this._setTextContent(node.querySelector('.expression-reading'), reading.length > 0 ? reading : expression); + this._setTextContent(node.querySelector('.expression-reading'), reading); this._appendFurigana(expressionContainer, furiganaSegments, this._appendKanjiLinks.bind(this)); this._appendMultiple(tagContainer, this._createTag.bind(this), termTags); |