aboutsummaryrefslogtreecommitdiff
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.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 808aa941..1fcd0838 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -150,8 +150,7 @@ function populateDictionaries(opts) {
}
function onDictionaryDelete() {
- const dictDelete = $(this);
- dictDelete.prop('disabled', true);
+ const dictGroup = $(this).closest('.dict-group');
const dictError = $('#dict-error');
dictError.hide();
@@ -159,14 +158,20 @@ function onDictionaryDelete() {
const dictSpinner = $('#dict-spinner');
dictSpinner.show();
- const dictGroup = dictDelete.closest('.dict-group');
+ const dictProgress = dictGroup.find('.dict-delete-progress');
+ dictProgress.show();
+
+ const dictControls = dictGroup.find('.dict-controls');
+ dictControls.hide();
+
database().deleteDictionary(dictGroup.data('title')).then(() => {
dictGroup.slideUp();
}).catch(error => {
dictError.show().find('span').text(error);
- dictDelete.prop('disabled', false);
}).then(() => {
dictSpinner.hide();
+ dictProgress.hide();
+ dictControls.show();
});
}
@@ -177,14 +182,14 @@ function onDictionaryImport() {
const dictError = $('#dict-error');
dictError.hide();
+ const dictProgress = $('#dict-import-progress');
+ dictProgress.show();
+
const dictSpinner = $('#dict-spinner');
dictSpinner.show();
- const progressbar = $('#dict-import-progress');
- progressbar.show();
-
const callback = (total, current) => {
- progressbar.find('div').css('width', `${current / total * 100.0}%`);
+ dictProgress.find('div').css('width', `${current / total * 100.0}%`);
};
const dictUrl = $('#dict-url');
@@ -196,7 +201,7 @@ function onDictionaryImport() {
dictImport.prop('disabled', false);
dictUrl.val('');
dictUrl.trigger('input');
- progressbar.hide();
+ dictProgress.hide();
dictSpinner.hide();
});
}