diff options
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/display/display-generator.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 95b4224b..fe899e53 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -232,12 +232,21 @@ class DisplayGenerator { // Private _createTermHeadword(headword, headwordIndex, pronunciations) { - const {term, reading, tags} = headword; + const {term, reading, tags, sources} = headword; + + let isPrimaryAny = false; + for (const {isPrimary} of sources) { + if (isPrimary) { + isPrimaryAny = true; + break; + } + } const node = this._templates.instantiate('headword'); const termContainer = node.querySelector('.headword-term'); + node.dataset.isPrimary = `${isPrimaryAny}`; node.dataset.readingIsSame = `${reading === term}`; node.dataset.frequency = DictionaryDataUtil.getTermFrequency(tags); |