Skip to content

Commit

Permalink
Show metadata when clicking on kanji dict tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Nov 26, 2024
1 parent ec95f84 commit a8043bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ext/js/display/display-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,24 @@ export class DisplayGenerator {
const dictionaryTag = this._createDictionaryTag('');
dictionaryTag.name = dictionaryEntry.dictionaryAlias;
dictionaryTag.content = [dictionaryEntry.dictionary];
const currentDictionaryInfo = dictionaryInfo.find(({title}) => title === dictionaryEntry.dictionary);
if (currentDictionaryInfo) {
const dictionaryContentArray = [];
dictionaryContentArray.push(currentDictionaryInfo.title);
if (currentDictionaryInfo.author) {
dictionaryContentArray.push('Author: ' + currentDictionaryInfo.author);
}
if (currentDictionaryInfo.description) {
dictionaryContentArray.push('Description: ' + currentDictionaryInfo.description);
}

const totalKanji = currentDictionaryInfo.counts.kanji.total;
if (totalKanji > 0) {
dictionaryContentArray.push('Kanji Count: ' + totalKanji.toString());
}

dictionaryTag.content = dictionaryContentArray;
}

this._appendMultiple(frequencyGroupListContainer, this._createFrequencyGroup.bind(this), groupedFrequencies, true);
this._appendMultiple(tagContainer, this._createTag.bind(this), [...dictionaryEntry.tags, dictionaryTag]);
Expand Down

0 comments on commit a8043bf

Please sign in to comment.