summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/context-main.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/bg/js/context-main.js b/ext/bg/js/context-main.js
index 65853514..e9833687 100644
--- a/ext/bg/js/context-main.js
+++ b/ext/bg/js/context-main.js
@@ -100,6 +100,7 @@ class DisplayController {
toggle.checked = extensionEnabled;
toggle.addEventListener('change', onToggleChanged, false);
}
+ this._updateDictionariesEnabledWarnings(options);
}
async _setupHotkeys() {
@@ -150,6 +151,26 @@ class DisplayController {
}]
);
}
+
+ async _updateDictionariesEnabledWarnings(options) {
+ const noDictionariesEnabledWarnings = document.querySelectorAll('.no-dictionaries-enabled-warning');
+ const dictionaries = await api.getDictionaryInfo();
+
+ let enabledCount = 0;
+ for (const {title} of dictionaries) {
+ if (
+ Object.prototype.hasOwnProperty.call(options.dictionaries, title) &&
+ options.dictionaries[title].enabled
+ ) {
+ ++enabledCount;
+ }
+ }
+
+ const hasEnabledDictionary = (enabledCount > 0);
+ for (const node of noDictionariesEnabledWarnings) {
+ node.hidden = hasEnabledDictionary;
+ }
+ }
}
(async () => {