diff options
| author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-05-12 21:44:05 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-13 01:44:05 +0000 | 
| commit | d5c28a3b3aee933a6d54ca62877a83e0505cb894 (patch) | |
| tree | 469afa3cfa64d5ea74c4fdeab039ff247f987c6d /ext | |
| parent | 486eec15b817d6a87ad98245dea3534545286334 (diff) | |
Fix Frequency sorting dictionary setting dropdown showing all dictionaries instead of only dictionaries with frequency data (#924)
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/js/pages/settings/sort-frequency-dictionary-controller.js | 22 | 
1 files changed, 6 insertions, 16 deletions
| diff --git a/ext/js/pages/settings/sort-frequency-dictionary-controller.js b/ext/js/pages/settings/sort-frequency-dictionary-controller.js index a88a2d47..774c3e35 100644 --- a/ext/js/pages/settings/sort-frequency-dictionary-controller.js +++ b/ext/js/pages/settings/sort-frequency-dictionary-controller.js @@ -107,11 +107,12 @@ export class SortFrequencyDictionaryController {          option.textContent = 'None';          fragment.appendChild(option);          for (const {title, counts} of dictionaries) { -            if (this._dictionaryHasNoFrequencies(counts)) { continue; } -            option = document.createElement('option'); -            option.value = title; -            option.textContent = title; -            fragment.appendChild(option); +            if (counts.termMeta.freq > 0) { +                option = document.createElement('option'); +                option.value = title; +                option.textContent = title; +                fragment.appendChild(option); +            }          }          const select = /** @type {HTMLSelectElement} */ (this._sortFrequencyDictionarySelect);          select.textContent = ''; @@ -196,17 +197,6 @@ export class SortFrequencyDictionaryController {      }      /** -     * @param {import('dictionary-importer').SummaryCounts} counts -     * @returns {boolean} -     */ -    _dictionaryHasNoFrequencies(counts) { -        if (typeof counts !== 'object' || counts === null) { return false; } -        const {termMeta} = counts; -        if (typeof termMeta !== 'object' || termMeta === null) { return false; } -        return termMeta.freq <= 0; -    } - -    /**       * @param {string} value       * @returns {?import('settings').SortFrequencyDictionaryOrder}       */ |