diff options
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/js/settings.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 3c261b88..06dba538 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -121,9 +121,6 @@ async function formWrite(options) { $('#scan-modifier-key').val(options.scanning.modifier); $('#popup-nesting-max-depth').val(options.scanning.popupNestingMaxDepth); - $('#dict-purge-link').click(utilAsync(onDictionaryPurge)); - $('#dict-file').change(utilAsync(onDictionaryImport)); - $('#anki-enable').prop('checked', options.anki.enable); $('#card-tags').val(options.anki.tags.join(' ')); $('#sentence-detection-extent').val(options.anki.sentenceExt); @@ -131,9 +128,6 @@ async function formWrite(options) { $('#screenshot-format').val(options.anki.screenshot.format); $('#screenshot-quality').val(options.anki.screenshot.quality); $('#field-templates').val(options.anki.fieldTemplates); - $('#field-templates-reset').click(utilAsync(onAnkiFieldTemplatesReset)); - $('input, select, textarea').not('.anki-model').change(utilAsync(onFormOptionsChanged)); - $('.anki-model').change(utilAsync(onAnkiModelChanged)); try { await dictionaryGroupsPopulate(options); @@ -151,6 +145,15 @@ async function formWrite(options) { formUpdateVisibility(options); } +function formSetupEventListeners() { + $('#dict-purge-link').click(utilAsync(onDictionaryPurge)); + $('#dict-file').change(utilAsync(onDictionaryImport)); + + $('#field-templates-reset').click(utilAsync(onAnkiFieldTemplatesReset)); + $('input, select, textarea').not('.anki-model').not('.profile-form *').change(utilAsync(onFormOptionsChanged)); + $('.anki-model').change(utilAsync(onAnkiModelChanged)); +} + function formUpdateVisibility(options) { const general = $('#anki-general'); if (options.anki.enable) { @@ -237,6 +240,7 @@ async function onReady() { const optionsContext = getOptionsContext(); const options = await apiOptionsGet(optionsContext); + formSetupEventListeners(); await formWrite(options); storageInfoInitialize(); |