summaryrefslogtreecommitdiff
path: root/ext/js/pages/action-popup-main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-04-03 13:02:49 -0400
committerGitHub <noreply@github.com>2021-04-03 13:02:49 -0400
commita9fe2d03b22a0dd5760019f1325a7a86ebb07b85 (patch)
treeaa2fe04c741c82c0456f44a39139c52988b6c22d /ext/js/pages/action-popup-main.js
parent0d2d342cd373798e3daf42799a9f35d974db92f5 (diff)
Update dictionary settings structure (#1587)
* Update dictionary settings structure to use an array instead of an object * Update ensureDictionarySettings implementation * Remove some usage of ObjectPropertyAccessor
Diffstat (limited to 'ext/js/pages/action-popup-main.js')
-rw-r--r--ext/js/pages/action-popup-main.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/js/pages/action-popup-main.js b/ext/js/pages/action-popup-main.js
index 2f18e028..2de986da 100644
--- a/ext/js/pages/action-popup-main.js
+++ b/ext/js/pages/action-popup-main.js
@@ -191,12 +191,16 @@ class DisplayController {
const noDictionariesEnabledWarnings = document.querySelectorAll('.no-dictionaries-enabled-warning');
const dictionaries = await yomichan.api.getDictionaryInfo();
+ const enabledDictionaries = new Set();
+ for (const {name, enabled} of options.dictionaries) {
+ if (enabled) {
+ enabledDictionaries.add(name);
+ }
+ }
+
let enabledCount = 0;
for (const {title} of dictionaries) {
- if (
- Object.prototype.hasOwnProperty.call(options.dictionaries, title) &&
- options.dictionaries[title].enabled
- ) {
+ if (enabledDictionaries.has(title)) {
++enabledCount;
}
}