Cleanup
This commit is contained in:
parent
72ed8be877
commit
984a3ad756
@ -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');
|
||||
|
@ -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)))
|
||||
+ " <small>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)))
|
||||
+ "</small></h4>\n </div>\n <div class=\"col-xs-4 text-right disabled\">\n <button type=\"button\" class=\"dict-controls dict-delete btn btn-danger\">Delete</button>\n </div>\n </div>\n <div class=\"dict-delete-progress\">Dictionary data is being deleted, please be patient...</div>\n <div class=\"progress dict-delete-progress\">\n <div class=\"progress-bar progress-bar-striped progress-bar-danger\" style=\"width: 0%\"></div>\n </div>\n <div class=\"checkbox dict-controls "
|
||||
+ "</small></h4>\n </div>\n <div class=\"col-xs-4 text-right disabled\">\n <button type=\"button\" class=\"dict-group-controls dict-delete btn btn-danger\">Delete</button>\n </div>\n </div>\n\n <div class=\"dict-delete-progress\">\n Dictionary data is being deleted, please be patient...\n <div class=\"progress\">\n <div class=\"progress-bar progress-bar-striped progress-bar-danger\" style=\"width: 0%\"></div>\n </div>\n </div>\n\n <div class=\"checkbox dict-group-controls "
|
||||
+ ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasTerms : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
+ "\">\n <label><input type=\"checkbox\" class=\"dict-enable-terms\" "
|
||||
+ ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasTerms : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
+ " "
|
||||
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.enableTerms : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
+ "> Enable term search</label>\n </div>\n <div class=\"checkbox dict-controls "
|
||||
+ "> Enable term search</label>\n </div>\n <div class=\"checkbox dict-group-controls "
|
||||
+ ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasKanji : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
+ "\">\n <label><input type=\"checkbox\" class=\"dict-enable-kanji\" "
|
||||
+ ((stack1 = helpers.unless.call(alias1,(depth0 != null ? depth0.hasKanji : depth0),{"name":"unless","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css">
|
||||
<style>
|
||||
#anki-spinner, #anki-general, #anki-error,
|
||||
#dict-spinner, #dict-error, #dict-warning, .dict-purge-progress, .dict-import-progress, .dict-delete-progress,
|
||||
#dict-spinner, #dict-error, #dict-warning, #dict-purge-progress, #dict-import-progress, .dict-delete-progress,
|
||||
#options-advanced {
|
||||
display: none;
|
||||
}
|
||||
@ -77,13 +77,17 @@
|
||||
wait for import and delete operations to complete before closing this page.
|
||||
</p>
|
||||
|
||||
<div class="dict-purge-progress">Dictionary data is being purged, please be patient...</div>
|
||||
<div id="dict-purge-progress">
|
||||
Dictionary data is being purged, please be patient...
|
||||
</div>
|
||||
|
||||
<div id="dict-groups"></div>
|
||||
|
||||
<div class="alert alert-warning" id="dict-warning">
|
||||
<strong>No dictionaries found:</strong>
|
||||
<span>please use the drop down below to install packaged and external dictionaries</span>
|
||||
<strong>Warning:</strong>
|
||||
<span>
|
||||
No dictionaries found, use the importer below to install packaged and external dictionaries
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger" id="dict-error">
|
||||
@ -91,9 +95,11 @@
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
<div class="dict-import-progress">Dictionary data is being imported, please be patient...</div>
|
||||
<div class="progress dict-import-progress">
|
||||
<div class="progress-bar progress-bar-striped" style="width: 0%"></div>
|
||||
<div id="dict-import-progress">
|
||||
Dictionary data is being imported, please be patient...
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-striped" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group" id="dict-importer">
|
||||
|
@ -4,17 +4,21 @@
|
||||
<h4><span class="text-muted glyphicon glyphicon-book"></span> {{title}} <small>v.{{version}}</small></h4>
|
||||
</div>
|
||||
<div class="col-xs-4 text-right disabled">
|
||||
<button type="button" class="dict-controls dict-delete btn btn-danger">Delete</button>
|
||||
<button type="button" class="dict-group-controls dict-delete btn btn-danger">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dict-delete-progress">Dictionary data is being deleted, please be patient...</div>
|
||||
<div class="progress dict-delete-progress">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-danger" style="width: 0%"></div>
|
||||
|
||||
<div class="dict-delete-progress">
|
||||
Dictionary data is being deleted, please be patient...
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-danger" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="checkbox dict-controls {{#unless hasTerms}}disabled{{/unless}}">
|
||||
|
||||
<div class="checkbox dict-group-controls {{#unless hasTerms}}disabled{{/unless}}">
|
||||
<label><input type="checkbox" class="dict-enable-terms" {{#unless hasTerms}}disabled{{/unless}} {{#if enableTerms}}checked{{/if}}> Enable term search</label>
|
||||
</div>
|
||||
<div class="checkbox dict-controls {{#unless hasKanji}}disabled{{/unless}}">
|
||||
<div class="checkbox dict-group-controls {{#unless hasKanji}}disabled{{/unless}}">
|
||||
<label><input type="checkbox" class="dict-enable-kanji" {{#unless hasKanji}}disabled{{/unless}} {{#if enableKanji}}checked{{/if}}> Enable Kanji search</label>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user