diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-05-21 17:11:17 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-05-21 17:11:17 -0700 |
commit | ad54735a80ede1980eca4ab51273256c5fd8d3bd (patch) | |
tree | 8a30901eb2ed5766da6d49b78ea5421313878878 /ext/bg/js/options-form.js | |
parent | 8b4d19c9f2d35ef53bbd8543f1d39f95c355bf12 (diff) |
WIP
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r-- | ext/bg/js/options-form.js | 20 |
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); }); }); |