diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-06-25 15:43:29 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-06-25 15:43:29 -0700 |
commit | 4cb7e8d2ac9bca9912dc728a0bd43f643bff6dda (patch) | |
tree | df2605c635770b7f9e5d31d4a24ff9d6945cef76 /ext/bg | |
parent | d3c342071f1397a59f94d89ca617e6294c50f861 (diff) |
reset file input after upload
Diffstat (limited to 'ext/bg')
-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(); |