Skip to content

Commit

Permalink
Fix firefox not showing Frequency Count when clicking on freq dict tag
Browse files Browse the repository at this point in the history
<rikaitan.link>NDUwZjFmOTE4Yjk2MjkwMzc4ODFjOWMzNzUyMjZmZTJiYTY4ODk4Ngo=</rikaitan.link>
  • Loading branch information
jason-ojisan committed Dec 10, 2024
1 parent f0339e7 commit ebc55bf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ext/js/display/display-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ export class DisplayGenerator {
* @returns {HTMLElement}
*/
_createFrequencyGroup(details, kanji) {
const {dictionary, dictionaryAlias, frequencies} = details;
const {dictionary, dictionaryAlias, frequencies, freqCount} = details;

const node = this._instantiate('frequency-group-item');
const body = this._querySelector(node, '.tag-body-content');
Expand All @@ -863,8 +863,8 @@ export class DisplayGenerator {
const item = frequencies[i];
const itemNode = (
kanji ?
this._createKanjiFrequency(/** @type {import('dictionary-data-util').KanjiFrequency} */ (item), dictionary, dictionaryAlias) :
this._createTermFrequency(/** @type {import('dictionary-data-util').TermFrequency} */ (item), dictionary, dictionaryAlias)
this._createKanjiFrequency(/** @type {import('dictionary-data-util').KanjiFrequency} */ (item), dictionary, dictionaryAlias, freqCount?.toString()) :
this._createTermFrequency(/** @type {import('dictionary-data-util').TermFrequency} */ (item), dictionary, dictionaryAlias, freqCount?.toString())
);
itemNode.dataset.index = `${i}`;
body.appendChild(itemNode);
Expand All @@ -873,17 +873,18 @@ export class DisplayGenerator {
body.dataset.count = `${ii}`;
node.dataset.count = `${ii}`;
node.dataset.details = dictionary;
tag.dataset.details = dictionary + '\nFrequency Count: ' + details.freqCount?.toString();
tag.dataset.details = dictionary + '\nFrequency Count: ' + freqCount?.toString();
return node;
}

/**
* @param {import('dictionary-data-util').TermFrequency} details
* @param {string} dictionary
* @param {string} dictionaryAlias
* @param {string} freqCount
* @returns {HTMLElement}
*/
_createTermFrequency(details, dictionary, dictionaryAlias) {
_createTermFrequency(details, dictionary, dictionaryAlias, freqCount) {
const {term, reading, values} = details;
const node = this._instantiate('term-frequency-item');
const tagLabel = this._querySelector(node, '.tag-label-content');
Expand All @@ -905,17 +906,18 @@ export class DisplayGenerator {
node.dataset.readingIsSame = `${reading === term}`;
node.dataset.dictionary = dictionary;
node.dataset.details = dictionary;
tag.dataset.details = dictionary;
tag.dataset.details = dictionary + '\nFrequency Count: ' + freqCount;
return node;
}

/**
* @param {import('dictionary-data-util').KanjiFrequency} details
* @param {string} dictionary
* @param {string} dictionaryAlias
* @param {string} freqCount
* @returns {HTMLElement}
*/
_createKanjiFrequency(details, dictionary, dictionaryAlias) {
_createKanjiFrequency(details, dictionary, dictionaryAlias, freqCount) {
const {character, values} = details;
const node = this._instantiate('kanji-frequency-item');
const tagLabel = this._querySelector(node, '.tag-label-content');
Expand All @@ -928,7 +930,7 @@ export class DisplayGenerator {
node.dataset.character = character;
node.dataset.dictionary = dictionary;
node.dataset.details = dictionary;
tag.dataset.details = dictionary;
tag.dataset.details = dictionary + '\nFrequency Count: ' + freqCount;

return node;
}
Expand Down

0 comments on commit ebc55bf

Please sign in to comment.