summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-21 15:50:59 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-21 15:50:59 -0700
commitc2532a9fd05977c0524084cf8b26eeb00d473826 (patch)
tree75c0a7b0676247ccd3533ee4496d21831da3a72e /ext/bg/js
parent0e6c9d70f65bda9b55c838d44aed2f8384c05338 (diff)
WIP
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options-form.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 422b9b4a..53e65b6f 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -35,7 +35,16 @@ function formToOptions() {
});
}
+function updateVisibility() {
+ if ($('#enableAnkiConnect').prop('checked')) {
+ $('.options-anki').show();
+ } else {
+ $('.options-anki').hide();
+ }
+}
+
function onOptionsChanged() {
+ updateVisibility();
const opts = formToOptions();
saveOptions(opts, () => {
chrome.extension.getBackgroundPage().yomichan.setOptions(opts);
@@ -44,6 +53,7 @@ function onOptionsChanged() {
$(document).ready(() => {
loadOptions((opts) => {
+ updateVisibility();
optionsToForm(opts);
$('input').on('input paste change', onOptionsChanged);
});