From 73c7c225f11b9a1da550b9b866f106b188bd82ea Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 6 Nov 2016 18:30:51 -0800 Subject: Save dictionary options --- ext/bg/js/options-form.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index 3ea850b7..f9346d7d 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -91,6 +91,14 @@ function getFormValues() { optsNew.ankiKanjiModel = $('#anki-kanji-model').val(); optsNew.ankiKanjiFields = fieldsToDict($('#kanji .anki-field-value')); + $('.dictionary').each((index, element) => { + const dictionary = $(element); + const name = dictionary.data('name'); + const enableTerms = dictionary.find('.dict-enable-terms').prop('checked'); + const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked'); + optsNew.dictionaries[name] = {enableTerms, enableKanji}; + }); + return { optsNew: sanitizeOptions(optsNew), optsOld: sanitizeOptions(optsOld) @@ -172,12 +180,14 @@ function populateDictionaries(opts) { container.append($(html)); }); + + container.find('.dictionary input').change(onOptionsChanged); }); } function populateAnkiFields(element, opts) { const tab = element.closest('.tab-pane'); - const container = tab.find('.anki-fields tbody'); + const container = tab.find('tbody'); container.empty(); const modelName = element.val(); -- cgit v1.2.3