aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-12 20:14:05 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-12 20:14:05 -0800
commit94034890cc21a57e3ea579aab3eaa88ae3aab360 (patch)
treea61d88364da2a50937f604fb44b54c75fb8cec2f /ext/bg/js/options-form.js
parentc574ef4bc035947aac304b19101a791db3a8b91f (diff)
WIP
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 8cffb2f7..f53808e8 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -39,7 +39,7 @@ function getFormValues() {
optsNew.scanDelay = parseInt($('#scan-delay').val(), 10);
optsNew.scanLength = parseInt($('#scan-length').val(), 10);
- optsNew.ankiMethod = $('#anki-method').val();
+ optsNew.ankiEnable = $('#anki-enable').prop('checked');
optsNew.ankiCardTags = $('#anki-card-tags').val().split(/[,; ]+/);
optsNew.sentenceExtent = parseInt($('#sentence-extent').val(), 10);
optsNew.ankiTermDeck = $('#anki-term-deck').val();
@@ -65,13 +65,10 @@ function getFormValues() {
}
function updateVisibility(opts) {
- switch (opts.ankiMethod) {
- case 'ankiconnect':
- $('#anki-general').show();
- break;
- default:
- $('#anki-general').hide();
- break;
+ if (opts.ankiEnable) {
+ $('#anki-general').show();
+ } else {
+ $('#anki-general').hide();
}
if (opts.showAdvancedOptions) {
@@ -96,7 +93,7 @@ $(document).ready(() => {
$('#scan-delay').val(opts.scanDelay);
$('#scan-length').val(opts.scanLength);
- $('#anki-method').val(opts.ankiMethod);
+ $('#anki-enable').prop('checked', opts.ankiEnable);
$('#anki-card-tags').val(opts.ankiCardTags.join(' '));
$('#sentence-extent').val(opts.sentenceExtent);
@@ -424,7 +421,7 @@ function onOptionsChanged(e) {
return saveOptions(optsNew).then(() => {
yomichan().setOptions(optsNew);
updateVisibility(optsNew);
- if (optsNew.ankiMethod !== optsOld.ankiMethod) {
+ if (optsNew.ankiEnable !== optsOld.ankiEnable) {
showAnkiError(null);
showAnkiSpinner(true);
return populateAnkiDeckAndModel(optsNew);