summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-16 21:19:52 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-16 21:30:38 -0500
commit545b4d3311d34f48cf714c63a50f4765fe775ef9 (patch)
treec05a64c5a81629b7b21965432f3cc462e0ea2ba1 /ext
parent38a00777570b9a12fc39365af6a2646fb4af451a (diff)
Fix search tags in split and grouped display modes (#1412)
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/css/display.css3
-rw-r--r--ext/mixed/js/display-generator.js11
2 files changed, 13 insertions, 1 deletions
diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css
index e13d8f91..5bac2575 100644
--- a/ext/mixed/css/display.css
+++ b/ext/mixed/css/display.css
@@ -973,6 +973,9 @@ button.action-button[data-icon=source-term]::before {
bottom: -0.5em;
white-space: nowrap;
}
+.entry[data-type=term][data-expression-multi=true] .term-tags>.tag[data-category=search] {
+ display: none;
+}
/* Definitions */
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) {