From 4cb7e8d2ac9bca9912dc728a0bd43f643bff6dda Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 25 Jun 2017 15:43:29 -0700 Subject: [PATCH] reset file input after upload --- ext/bg/js/options.js | 6 ++++-- 1 file 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();