add option for html cards

This commit is contained in:
Alex Yatskov 2017-01-18 20:46:17 -08:00
parent 404f3f1b16
commit 03e1a03634
3 changed files with 7 additions and 0 deletions

View File

@ -41,6 +41,7 @@ function getFormData() {
optionsNew.anki.enable = $('#anki-enable').prop('checked'); optionsNew.anki.enable = $('#anki-enable').prop('checked');
optionsNew.anki.tags = $('#card-tags').val().split(/[,; ]+/); optionsNew.anki.tags = $('#card-tags').val().split(/[,; ]+/);
optionsNew.anki.htmlCards = $('#generate-html-cards').prop('checked');
optionsNew.anki.sentenceExt = parseInt($('#sentence-detection-extent').val(), 10); optionsNew.anki.sentenceExt = parseInt($('#sentence-detection-extent').val(), 10);
if (optionsOld.anki.enable) { if (optionsOld.anki.enable) {
optionsNew.anki.terms.deck = $('#anki-terms-deck').val(); optionsNew.anki.terms.deck = $('#anki-terms-deck').val();
@ -101,6 +102,7 @@ $(document).ready(() => {
$('#anki-enable').prop('checked', options.anki.enable); $('#anki-enable').prop('checked', options.anki.enable);
$('#card-tags').val(options.anki.tags.join(' ')); $('#card-tags').val(options.anki.tags.join(' '));
$('#generate-html-cards').prop('checked', options.anki.htmlCards);
$('#sentence-detection-extent').val(options.anki.sentenceExt); $('#sentence-detection-extent').val(options.anki.sentenceExt);
$('input, select').not('.anki-model').change(onOptionsChanged); $('input, select').not('.anki-model').change(onOptionsChanged);
$('.anki-model').change(onAnkiModelChanged); $('.anki-model').change(onAnkiModelChanged);

View File

@ -39,6 +39,7 @@ function optionsSetDefaults(options) {
anki: { anki: {
enable: false, enable: false,
tags: ['yomichan'], tags: ['yomichan'],
htmlCards: true,
sentenceExt: 200, sentenceExt: 200,
terms: {deck: '', model: '', fields: {}}, terms: {deck: '', model: '', fields: {}},
kanji: {deck: '', model: '', fields: {}} kanji: {deck: '', model: '', fields: {}}

View File

@ -142,6 +142,10 @@
</div> </div>
<div id="anki-general"> <div id="anki-general">
<div class="checkbox">
<label><input type="checkbox" id="generate-html-cards"> Generate HTML cards</label>
</div>
<div class="form-group"> <div class="form-group">
<label for="card-tags">Card tags (comma or space separated)</label> <label for="card-tags">Card tags (comma or space separated)</label>
<input type="text" id="card-tags" class="form-control"> <input type="text" id="card-tags" class="form-control">