aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index fec2494a..a77419ff 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -43,6 +43,25 @@ function updateVisibility() {
}
}
+function updateAnkiPage() {
+ const yomichan = chrome.extension.getBackgroundPage().yomichan;
+
+ $('#ankiDeck').find('option').remove();
+ $('#ankiModel').find('option').remove();
+
+ yomichan.getDeckNames((names) => {
+ names.forEach((name) => {
+ $('#ankiDeck').append($('<option/>', {value: name, text: name}));
+ });
+ });
+
+ yomichan.getModelNames((names) => {
+ names.forEach((name) => {
+ $('#ankiModel').append($('<option/>', {value: name, text: name}));
+ });
+ });
+}
+
function onOptionsChanged() {
updateVisibility();
const opts = formToOptions();
@@ -55,6 +74,7 @@ $(document).ready(() => {
loadOptions((opts) => {
optionsToForm(opts);
updateVisibility();
+ updateAnkiPage();
$('input').on('input paste change', onOptionsChanged);
});
});