aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-06-12 22:36:12 -0700
committerAlex Yatskov <alex@foosoft.net>2016-06-14 20:44:38 -0700
commit19c9a16e464802aaf224c5bc74544cf04ea04769 (patch)
treed4d7c320fff470f9b89fc58b84bfb67c6010871a /ext/bg/js
parent3ed5b90ccb6e5a6f73311abb29f4bb5e5c6821b6 (diff)
Option stubs
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options-form.js10
-rw-r--r--ext/bg/js/options.js2
2 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index d515b789..63fcfdc3 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -47,6 +47,8 @@ function formToOptions(section, callback) {
optsNew.enableAnkiConnect = $('#enable-anki-connect').prop('checked');
break;
case 'anki':
+ optsNew.ankiCardTags = $('#anki-card-tags').val().split(/[,; ]+/);
+ optsNew.ankiHtmlCards = $('#anki-html-cards').prop('checked');
optsNew.ankiVocabDeck = $('#anki-vocab-deck').val();
optsNew.ankiVocabModel = $('#anki-vocab-model').val();
optsNew.ankiVocabFields = fieldsToDict($('#vocab .anki-field-value'));
@@ -91,8 +93,12 @@ function updateAnkiStatus() {
yomichan().api_getVersion({callback: (version) => {
if (version === null) {
$('.error-dlg-connection').show();
+ $('.options-anki-controls').hide();
} else if (version !== yomichan().getApiVersion()) {
$('.error-dlg-version').show();
+ $('.options-anki-controls').hide();
+ } else {
+ $('.options-anki-controls').show();
}
}});
}
@@ -166,7 +172,11 @@ $(document).ready(() => {
$('#select-matched-text').prop('checked', opts.selectMatchedText);
$('#enable-anki-connect').prop('checked', opts.enableAnkiConnect);
+ $('#anki-card-tags').val(opts.ankiCardTags.join(' '));
+ $('#anki-html-cards').prop('checked', opts.ankiHtmlCards);
+
$('.options-general input').change(onOptionsGeneralChanged);
+ $('.options-anki input').change(onOptionsAnkiChanged);
$('.anki-deck').change(onOptionsAnkiChanged);
$('.anki-model').change(onAnkiModelChanged);
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 0a5197f9..f689c90a 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -24,6 +24,8 @@ function sanitizeOptions(options) {
selectMatchedText: true,
loadEnamDict: false,
enableAnkiConnect: false,
+ ankiCardTags: ['yomichan'],
+ ankiHtmlCards: true,
ankiVocabDeck: '',
ankiVocabModel: '',
ankiVocabFields: {},