aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/secondary-search-dictionary-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/settings/secondary-search-dictionary-controller.js')
-rw-r--r--ext/js/pages/settings/secondary-search-dictionary-controller.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/js/pages/settings/secondary-search-dictionary-controller.js b/ext/js/pages/settings/secondary-search-dictionary-controller.js
index 13e1dcf5..8ffd9a9b 100644
--- a/ext/js/pages/settings/secondary-search-dictionary-controller.js
+++ b/ext/js/pages/settings/secondary-search-dictionary-controller.js
@@ -15,10 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* global
- * ObjectPropertyAccessor
- */
-
class SecondarySearchDictionaryController {
constructor(settingsController) {
this._settingsController = settingsController;
@@ -60,21 +56,23 @@ class SecondarySearchDictionaryController {
const fragment = document.createDocumentFragment();
- for (const dictionary of Object.keys(options.dictionaries)) {
- const dictionaryInfo = this._dictionaryInfoMap.get(dictionary);
+ const {dictionaries} = options;
+ for (let i = 0, ii = dictionaries.length; i < ii; ++i) {
+ const {name} = dictionaries[i];
+ const dictionaryInfo = this._dictionaryInfoMap.get(name);
if (typeof dictionaryInfo === 'undefined') { continue; }
const node = this._settingsController.instantiateTemplate('secondary-search-dictionary');
fragment.appendChild(node);
const nameNode = node.querySelector('.dictionary-title');
- nameNode.textContent = dictionary;
+ nameNode.textContent = name;
const versionNode = node.querySelector('.dictionary-version');
versionNode.textContent = `rev.${dictionaryInfo.revision}`;
const toggle = node.querySelector('.dictionary-allow-secondary-searches');
- toggle.dataset.setting = ObjectPropertyAccessor.getPathString(['dictionaries', dictionary, 'allowSecondarySearches']);
+ toggle.dataset.setting = `dictionaries[${i}].allowSecondarySearches`;
this._eventListeners.addEventListener(toggle, 'settingChanged', this._onEnabledChanged.bind(this, node), false);
}