summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-05 18:45:57 -0500
committerGitHub <noreply@github.com>2020-11-05 18:45:57 -0500
commit3216a9e2633ce8b0790f5b4d3e891cb69e4f47c4 (patch)
treefe3586bf32028a733ce0f0916c0261596f0ca073 /ext/bg/js
parent5b9d709d4087c7d2b4210319840f6fc7b454d3b1 (diff)
Settings controller changes (#990)
* Make allowSecondarySearchesCheckbox optional * Move getDictionaryInfo into SettingsController
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/dictionary-controller.js6
-rw-r--r--ext/bg/js/settings/settings-controller.js4
2 files changed, 8 insertions, 2 deletions
diff --git a/ext/bg/js/settings/dictionary-controller.js b/ext/bg/js/settings/dictionary-controller.js
index 49102c5c..6c7e00b7 100644
--- a/ext/bg/js/settings/dictionary-controller.js
+++ b/ext/bg/js/settings/dictionary-controller.js
@@ -70,8 +70,10 @@ class DictionaryEntry {
if (detailsToggleLink !== null) { detailsToggleLink.hidden = !hasDetails; }
enabledCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'enabled']);
- allowSecondarySearchesCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'allowSecondarySearches']);
priorityInput.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'priority']);
+ if (allowSecondarySearchesCheckbox !== null) {
+ allowSecondarySearchesCheckbox.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', title, 'allowSecondarySearches']);
+ }
if (deleteButton !== null) {
this._eventListeners.addEventListener(deleteButton, 'click', this._onDeleteButtonClicked.bind(this), false);
@@ -235,7 +237,7 @@ class DictionaryController {
const token = {};
this._databaseStateToken = token;
this._dictionaries = null;
- const dictionaries = await api.getDictionaryInfo();
+ const dictionaries = await this._settingsController.getDictionaryInfo();
if (this._databaseStateToken !== token) { return; }
this._dictionaries = dictionaries;
diff --git a/ext/bg/js/settings/settings-controller.js b/ext/bg/js/settings/settings-controller.js
index 827d837b..48d1351a 100644
--- a/ext/bg/js/settings/settings-controller.js
+++ b/ext/bg/js/settings/settings-controller.js
@@ -98,6 +98,10 @@ class SettingsController extends EventDispatcher {
return await this.modifyProfileSettings([{action: 'set', path, value}]);
}
+ async getDictionaryInfo() {
+ return await api.getDictionaryInfo();
+ }
+
getOptionsContext() {
return {index: this._profileIndex};
}