summaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-11-13 17:50:09 -0800
committerAlex Yatskov <alex@foosoft.net>2016-11-13 17:50:09 -0800
commit253da36755f24d656664ca524808e3292eef3697 (patch)
treef29c3e298803d8da241ea7f6585d4c9732305206 /ext/bg/js/options-form.js
parenta9eea9f63497f2fe829f5b8d1ecf6c58f18b2b79 (diff)
WIP
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 => {