More cleanup

This commit is contained in:
Alex Yatskov 2016-05-28 15:21:01 -07:00
parent 9c51f2ecda
commit b229295688

View File

@ -55,18 +55,19 @@ function populateAnkiDeckAndModel(opts) {
names.forEach((name) => ankiDeck.append($('<option/>', {value: name, text: name}))); names.forEach((name) => ankiDeck.append($('<option/>', {value: name, text: name})));
} }
const ankiModel = $('.anki-model'); $('#anki-vocab-deck').val(opts.ankiVocabDeck);
ankiModel.find('option').remove(); $('#anki-kanji-deck').val(opts.ankiKanjiDeck);
yomi.api_getModelNames({callback: (names) => { }});
if (names !== null) {
names.forEach((name) => ankiModel.append($('<option/>', {value: name, text: name})));
}
$('#anki-vocab-deck').val(opts.ankiVocabDeck); const ankiModel = $('.anki-model');
populateAnkiFields($('#anki-vocab-model').val(opts.ankiVocabModel), opts); ankiModel.find('option').remove();
$('#anki-kanji-deck').val(opts.ankiKanjiDeck); yomi.api_getModelNames({callback: (names) => {
populateAnkiFields($('#anki-kanji-model').val(opts.ankiKanjiModel), opts); if (names !== null) {
}}); names.forEach((name) => ankiModel.append($('<option/>', {value: name, text: name})));
}
populateAnkiFields($('#anki-vocab-model').val(opts.ankiVocabModel), opts);
populateAnkiFields($('#anki-kanji-model').val(opts.ankiKanjiModel), opts);
}}); }});
} }