diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/options.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index cde1fc3f..5aa18366 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -254,19 +254,21 @@ function onDictionaryImport(e) { dictionaryErrorShow(null); dictionarySpinnerShow(true); - const dictUrl = $('#dict-url'); + const dictFile = $('#dict-file'); const dictImporter = $('#dict-importer').hide(); const dictProgress = $('#dict-import-progress').show(); const setProgress = percent => dictProgress.find('.progress-bar').css('width', `${percent}%`); + const updateProgress = (total, current) => setProgress(current / total * 100.0); setProgress(0.0); optionsLoad().then(options => { - return instDb().importDictionary(e.target.files[0], (total, current) => setProgress(current / total * 100.0)).then(summary => { + return instDb().importDictionary(e.target.files[0], updateProgress).then(summary => { options.dictionaries[summary.title] = {enabled: true, priority: 0}; return optionsSave(options); }).then(() => dictionaryGroupsPopulate(options)); }).catch(dictionaryErrorShow).then(() => { + dictFile.val(''); dictionarySpinnerShow(false); dictProgress.hide(); dictImporter.show(); |