From 984a3ad756732201c043232443e1d2b28dac043d Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 14 Nov 2016 08:15:08 -0800 Subject: Cleanup --- ext/bg/js/options-form.js | 16 +++++++++------- ext/bg/js/templates.js | 4 ++-- ext/bg/options.html | 20 +++++++++++++------- 3 files changed, 24 insertions(+), 16 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index d1e6fa18..ddb709d6 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -127,14 +127,16 @@ function onDictionaryDelete() { const dictProgress = dictGroup.find('.dict-delete-progress'); dictProgress.show(); - const dictControls = dictGroup.find('.dict-controls'); + const dictControls = dictGroup.find('.dict-group-controls'); dictControls.hide(); - const callback = (total, current) => { - dictProgress.find('div').css('width', `${current / total * 100.0}%`); + const setProgress = percent => { + dictProgress.find('.progress-bar').css('width', `${percent}%`); }; - database().deleteDictionary(dictGroup.data('title'), callback).catch(error => { + setProgress(0.0); + + database().deleteDictionary(dictGroup.data('title'), (total, current) => setProgress(current / total * 100.0)).catch(error => { dictError.show().find('span').text(error); }).then(() => { dictSpinner.hide(); @@ -151,14 +153,14 @@ function onDictionaryImport() { const dictError = $('#dict-error'); dictError.hide(); - const dictProgress = $('.dict-import-progress'); + const dictProgress = $('#dict-import-progress'); dictProgress.show(); const dictSpinner = $('#dict-spinner'); dictSpinner.show(); const setProgress = percent => { - dictProgress.find('div').css('width', `${percent}%`); + dictProgress.find('.progress-bar').css('width', `${percent}%`); }; setProgress(0.0); @@ -316,7 +318,7 @@ function onPurgeDb() { const dictControls = $('#dict-importer, #dict-groups'); dictControls.hide(); - const dictProgress = $('.dict-purge-progress'); + const dictProgress = $('#dict-purge-progress'); dictProgress.show(); const dictError = $('#dict-error'); diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 5edc5288..598d8641 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -13,13 +13,13 @@ templates['dictionary.html'] = template({"1":function(container,depth0,helpers,p + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + " v." + alias4(((helper = (helper = helpers.version || (depth0 != null ? depth0.version : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"version","hash":{},"data":data}) : helper))) - + "\n \n
\n \n
\n \n
Dictionary data is being deleted, please be patient...
\n
\n
\n
\n
\n
\n
\n \n
\n \n\n
\n Dictionary data is being deleted, please be patient...\n
\n
\n
\n
\n\n
\n \n
\n
Enable term search\n
\n
\n