summaryrefslogtreecommitdiff
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.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 2cabe162..015c9a0a 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -158,15 +158,17 @@ function onDictionaryImport() {
const dictSpinner = $('#dict-spinner');
dictSpinner.show();
- const callback = (total, current) => {
- dictProgress.find('div').css('width', `${current / total * 100.0}%`);
+ const setProgress = percent => {
+ dictProgress.find('div').css('width', `${percent}%`);
};
+ setProgress(0.0);
+
const dictUrl = $('#dict-url');
loadOptions().then(opts => {
- database().importDictionary(dictUrl.val(), callback).then(summary => {
+ database().importDictionary(dictUrl.val(), (total, current) => setProgress(current / total * 100.0)).then(summary => {
opts.dictionaries[summary.title] = {enableTerms: summary.hasTerms, enableKanji: summary.hasKanji};
- return saveOptions(opts);
+ return saveOptions(opts).then(() => yomichan().setOptions(opts));
}).then(() => {
return populateDictionaries(opts);
}).catch(error => {