summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-11-08 21:02:12 -0800
committerAlex Yatskov <alex@foosoft.net>2016-11-08 21:02:12 -0800
commit1b1f4a3ed7eaf29379be576e31ec4116347c6140 (patch)
tree46ab927041fc959a19b93d9079d27f5cf74a07f6 /ext
parentdeb4ef52bafdc6b698ab1ea34239125a61f4cd23 (diff)
WIP
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/options-form.js23
-rw-r--r--ext/bg/js/templates.js4
-rw-r--r--ext/bg/options.html4
3 files changed, 19 insertions, 12 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();
});
}
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js
index d198a76f..34347100 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)))
+ " <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-delete btn btn-danger\">Delete</button>\n </div>\n </div>\n <div class=\"progress\" id=\"dict-delete-progress\">\n <div class=\"progress-bar progress-bar-striped progress-bar-danger\" style=\"width: 0%\"></div>\n </div>\n <div class=\"checkbox "
+ + "</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=\"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 "
+ ((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 "
+ + "> Enable term search</label>\n </div>\n <div class=\"checkbox dict-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 : "")
diff --git a/ext/bg/options.html b/ext/bg/options.html
index e3f95bd4..57c6a482 100644
--- a/ext/bg/options.html
+++ b/ext/bg/options.html
@@ -6,7 +6,9 @@
<link rel="stylesheet" type="text/css" href="../lib/bootstrap-3.3.6-dist/css/bootstrap.min.css">
<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-import-progress, #dict-delete-progress, #dict-laggy, #options-advanced {
+ #anki-spinner, #anki-general, #anki-error,
+ #dict-spinner, #dict-import-progress, .dict-delete-progress,
+ #options-advanced {
display: none;
}