This commit is contained in:
Alex Yatskov 2017-01-15 11:22:34 -08:00
parent c512412c05
commit 655bcec511
2 changed files with 25 additions and 25 deletions

View File

@ -29,9 +29,9 @@ function getFormValues() {
const optionsNew = $.extend({}, optionsOld);
optionsNew.general.autoStart = $('#activate-on-startup').prop('checked');
optionsNew.general.audioPlayback = $('#enable-audio-playback').prop('checked');
optionsNew.general.softKatakana = $('#enable-soft-katakana-search').prop('checked');
optionsNew.general.groupResults = $('#group-term-results').prop('checked');
optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked');
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
optionsNew.scanning.requireShift = $('#hold-shift-to-scan').prop('checked');
@ -40,10 +40,10 @@ function getFormValues() {
optionsNew.scanning.length = parseInt($('#scan-length').val(), 10);
optionsNew.anki.enable = $('#anki-enable').prop('checked');
optionsNew.anki.tags = $('#anki-card-tags').val().split(/[,; ]+/);
optionsNew.anki.sentenceExt = parseInt($('#sentence-extent').val(), 10);
optionsNew.anki.terms.deck = $('#anki-term-deck').val();
optionsNew.anki.terms.model = $('#anki-term-model').val();
optionsNew.anki.tags = $('#card-tags').val().split(/[,; ]+/);
optionsNew.anki.sentenceExt = parseInt($('#sentence-detection-extent').val(), 10);
optionsNew.anki.terms.deck = $('#anki-terms-deck').val();
optionsNew.anki.terms.model = $('#anki-terms-model').val();
optionsNew.anki.terms.fields = fieldsToDict($('#terms .anki-field-value'));
optionsNew.anki.kanji.deck = $('#anki-kanji-deck').val();
optionsNew.anki.kanji.model = $('#anki-kanji-model').val();
@ -82,9 +82,9 @@ $(document).ready(() => {
optionsLoad().then(options => {
$('#activate-on-startup').prop('checked', options.general.autoStart);
$('#enable-audio-playback').prop('checked', options.general.audioPlayback);
$('#enable-soft-katakana-search').prop('checked', options.general.softKatakana);
$('#group-term-results').prop('checked', options.general.groupResults);
$('#audio-playback-buttons').prop('checked', options.general.audioPlayback);
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
$('#group-terms-results').prop('checked', options.general.groupResults);
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
$('#hold-shift-to-scan').prop('checked', options.scanning.requireShift);
@ -98,8 +98,8 @@ $(document).ready(() => {
$('#dict-url').on('input', onDictionaryUpdateUrl);
$('#anki-enable').prop('checked', options.anki.enable);
$('#anki-card-tags').val(options.anki.tags.join(' '));
$('#sentence-extent').val(options.anki.sentenceExt);
$('#card-tags').val(options.anki.tags.join(' '));
$('#sentence-detection-extent').val(options.anki.sentenceExt);
$('input, select').not('.anki-model').change(onOptionsChanged);
$('.anki-model').change(onAnkiModelChanged);
@ -309,7 +309,7 @@ function populateAnkiDeckAndModel(options) {
ankiDeck.find('option').remove();
deckNames.forEach(name => ankiDeck.append($('<option/>', {value: name, text: name})));
$('#anki-term-deck').val(options.anki.terms.deck);
$('#anki-terms-deck').val(options.anki.terms.deck);
$('#anki-kanji-deck').val(options.anki.kanji.deck);
const ankiModel = $('.anki-model');
@ -317,7 +317,7 @@ function populateAnkiDeckAndModel(options) {
modelNames.forEach(name => ankiModel.append($('<option/>', {value: name, text: name})));
return Promise.all([
populateAnkiFields($('#anki-term-model').val(options.anki.terms.model), options),
populateAnkiFields($('#anki-terms-model').val(options.anki.terms.model), options),
populateAnkiFields($('#anki-kanji-model').val(options.anki.kanji.model), options)
]);
}).then(() => {

View File

@ -30,15 +30,15 @@
</div>
<div class="checkbox">
<label><input type="checkbox" id="enable-audio-playback"> Enable audio playback</label>
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="enable-soft-katakana-search"> Enable soft Katakana search</label>
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="group-term-results"> Group term results</label>
<label><input type="checkbox" id="group-terms-results"> Group term results</label>
</div>
<div class="checkbox">
@ -143,13 +143,13 @@
<div id="anki-general">
<div class="form-group">
<label for="anki-card-tags">Card tags (comma or space separated)</label>
<input type="text" id="anki-card-tags" class="form-control">
<label for="card-tags">Card tags (comma or space separated)</label>
<input type="text" id="card-tags" class="form-control">
</div>
<div class="form-group options-advanced">
<label for="sentence-extent">Sentence detection extent</label>
<input type="number" min="1" id="sentence-extent" class="form-control">
<label for="sentence-detection-extent">Sentence detection extent</label>
<input type="number" min="1" id="sentence-detection-extent" class="form-control">
</div>
<div id="anki-format">
@ -162,13 +162,13 @@
<div id="terms" class="tab-pane fade in active">
<div class="row">
<div class="form-group col-xs-6">
<label for="anki-term-deck">Deck</label>
<select class="form-control anki-deck" id="anki-term-deck"></select>
<label for="anki-terms-deck">Deck</label>
<select class="form-control anki-deck" id="anki-terms-deck"></select>
</div>
<div class="form-group col-xs-6">
<label for="anki-term-model">Model</label>
<select class="form-control anki-model" id="anki-term-model"></select>
<label for="anki-terms-model">Model</label>
<select class="form-control anki-model" id="anki-terms-model"></select>
</div>
</div>