aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-16 22:30:53 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-16 22:30:53 -0800
commit404f3f1b164fd924a8d34521f86bf3660acdc008 (patch)
treee197a07b87a71c0907a337902aecb0e300d5d4b3 /ext/bg/js/options-form.js
parent268e00435f081b81ac0426bd3e316acb1bb33915 (diff)
unify dictionary enabled state
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index f58c26cc..7139958a 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -55,9 +55,8 @@ function getFormData() {
const dictionary = $(element);
const title = dictionary.data('title');
const priority = parseInt(dictionary.find('.dict-priority').val(), 10);
- const enableTerms = dictionary.find('.dict-enable-terms').prop('checked');
- const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked');
- optionsNew.dictionaries[title] = {priority, enableTerms, enableKanji};
+ const enabled = dictionary.find('.dict-enabled').prop('checked');
+ optionsNew.dictionaries[title] = {priority, enabled};
});
return {optionsNew, optionsOld};
@@ -153,18 +152,15 @@ function populateDictionaries(options) {
title: row.title,
version: row.version,
revision: row.revision,
- hasTerms: row.hasTerms,
- hasKanji: row.hasKanji,
priority: dictOptions.priority,
- enableTerms: dictOptions.enableTerms,
- enableKanji: dictOptions.enableKanji
+ enabled: dictOptions.enabled
});
dictGroups.append($(html));
++dictCount;
});
- $('.dict-enable-terms, .dict-enable-kanji, .dict-priority').change(onOptionsChanged);
+ $('.dict-enabled, .dict-priority').change(onOptionsChanged);
$('.dict-delete').click(onDictionaryDelete);
}).catch(error => {
showDictionaryError(error);
@@ -233,7 +229,7 @@ function onDictionaryImport() {
optionsLoad().then(options => {
database().importDictionary(dictUrl.val(), (total, current) => setProgress(current / total * 100.0)).then(summary => {
- options.dictionaries[summary.title] = {enableTerms: summary.hasTerms, enableKanji: summary.hasKanji};
+ options.dictionaries[summary.title] = {enabled: true, priority: 0};
return optionsSave(options).then(() => yomichan().setOptions(options));
}).then(() => {
return populateDictionaries(options);