summaryrefslogtreecommitdiff
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.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/mixed/js/display-generator.js b/ext/mixed/js/display-generator.js
index 70cbcf13..638c4727 100644
--- a/ext/mixed/js/display-generator.js
+++ b/ext/mixed/js/display-generator.js
@@ -71,7 +71,8 @@ class DisplayGenerator {
const uniqueExpressions = new Set();
const uniqueReadings = new Set();
- for (const {expression, reading} of expressions) {
+ for (let {expression, reading} of expressions) {
+ if (reading.length === 0) { reading = expression; }
uniqueExpressions.add(expression);
uniqueReadings.add(reading);
}
@@ -93,6 +94,14 @@ class DisplayGenerator {
this._appendMultiple(pitchesContainer, this._createPitches.bind(this), pitches);
this._appendMultiple(termTagsContainer, this._createTermTag.bind(this), termTags, expressions.length);
+ for (const expression of uniqueExpressions) {
+ termTagsContainer.appendChild(this._createSearchTag(expression));
+ }
+ for (const reading of uniqueReadings) {
+ if (uniqueExpressions.has(reading)) { continue; }
+ termTagsContainer.appendChild(this._createSearchTag(reading));
+ }
+
// Add definitions
const dictionaryTag = this._createDictionaryTag(null);
for (let i = 0, ii = definitions.length; i < ii; ++i) {