diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-01 22:16:58 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-01 22:16:58 -0500 |
commit | b4cdbf0263d270cf227490771bdff8ed2882fd9f (patch) | |
tree | e9951c7a2ba13c64ae83e4c13d92b35c05de76d8 /ext/bg/js/settings/main.js | |
parent | 3e1b080cd3f0846f623f6bcf186581ac27998256 (diff) |
Update how anki settings are updated
Diffstat (limited to 'ext/bg/js/settings/main.js')
-rw-r--r-- | ext/bg/js/settings/main.js | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/ext/bg/js/settings/main.js b/ext/bg/js/settings/main.js index a9edab78..82d75d8b 100644 --- a/ext/bg/js/settings/main.js +++ b/ext/bg/js/settings/main.js @@ -143,20 +143,14 @@ async function formWrite(options) { $('#field-templates').val(options.anki.fieldTemplates); onAnkiTemplatesValidateCompile(); + await onAnkiOptionsChanged(options); await onDictionaryOptionsChanged(options); - try { - await ankiDeckAndModelPopulate(options); - } catch (e) { - ankiErrorShow(e); - } - formUpdateVisibility(options); } function formSetupEventListeners() { $('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change((e) => onFormOptionsChanged(e)); - $('.anki-model').change((e) => onAnkiModelChanged(e)); } function formUpdateVisibility(options) { @@ -180,28 +174,12 @@ async function onFormOptionsChanged(e) { const optionsContext = getOptionsContext(); const options = await apiOptionsGet(optionsContext); - const optionsAnkiEnableOld = options.anki.enable; - const optionsAnkiServerOld = options.anki.server; await formRead(options); await settingsSaveOptions(); formUpdateVisibility(options); - try { - const ankiUpdated = - options.anki.enable !== optionsAnkiEnableOld || - options.anki.server !== optionsAnkiServerOld; - - if (ankiUpdated) { - ankiSpinnerShow(true); - await ankiDeckAndModelPopulate(options); - ankiErrorShow(); - } - } catch (error) { - ankiErrorShow(error); - } finally { - ankiSpinnerShow(false); - } + await onAnkiOptionsChanged(options); } @@ -254,6 +232,7 @@ async function onReady() { await audioSettingsInitialize(); await profileOptionsSetup(); await dictSettingsInitialize(); + ankiInitialize(); ankiTemplatesInitialize(); storageInfoInitialize(); |