diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-29 16:31:27 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-11-07 20:30:55 -0500 |
commit | 44638b7ceb8ec4e2a235ad4ffc9aa23ec66f21d2 (patch) | |
tree | 8ee35de72a4a075b9635042d53b215e8aaab5cec /ext/bg/js/settings.js | |
parent | 91c01e0a7eeeb851344a22ace8a5fa0b873a3e57 (diff) |
Simplify how option visibility is changed
Diffstat (limited to 'ext/bg/js/settings.js')
-rw-r--r-- | ext/bg/js/settings.js | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index 05a0604a..f2250911 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -171,36 +171,16 @@ function formSetupEventListeners() { } function formUpdateVisibility(options) { - const general = $('#anki-general'); - if (options.anki.enable) { - general.show(); - } else { - general.hide(); - } - - const advanced = $('.options-advanced'); - if (options.general.showAdvanced) { - advanced.show(); - } else { - advanced.hide(); - } + document.documentElement.dataset.optionsAnkiEnable = `${!!options.anki.enable}`; + document.documentElement.dataset.optionsGeneralDebugInfo = `${!!options.general.debugInfo}`; + document.documentElement.dataset.optionsGeneralShowAdvanced = `${!!options.general.showAdvanced}`; + document.documentElement.dataset.optionsGeneralResultOutputMode = `${options.general.resultOutputMode}`; - const mainGroup = $('#dict-main-group'); - if (options.general.resultOutputMode === 'merge') { - mainGroup.show(); - } else { - mainGroup.hide(); - } - - const debug = $('#debug'); if (options.general.debugInfo) { const temp = utilIsolate(options); temp.anki.fieldTemplates = '...'; const text = JSON.stringify(temp, null, 4); - debug.html(handlebarsEscape(text)); - debug.show(); - } else { - debug.hide(); + $('#debug').text(text); } } |