aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-11-06 22:19:48 -0800
committerAlex Yatskov <alex@foosoft.net>2016-11-06 22:19:48 -0800
commited2091ae1b4976b90d29f5e84efdcd41227f66b0 (patch)
tree79c96bb1a9116872b005a3bed9866ab9ab25d71e /ext/bg/js/options-form.js
parent6eab90b89c7320476e06ab4699d6e86ef0a967ae (diff)
WIP
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 63e2d2f5..ea318092 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -166,7 +166,7 @@ function populateDictionaries(opts) {
const container = $('.dicts');
container.empty();
- yomichan().translator.dictionary.getInfo().then(rows => {
+ yomichan().translator.dictionary.getDictionaries().then(rows => {
rows.forEach(row => {
const dictOpts = opts.dictionaries[row.title] || {enableTerms: true, enableKanji: false};
const html = Handlebars.templates['dictionary.html']({
@@ -181,6 +181,13 @@ function populateDictionaries(opts) {
container.append($(html));
});
+ const dictDelete = $('.dict-delete');
+ dictDelete.click(() => {
+ const dict = dictDelete.closest('.dict');
+ const title = dict.data('title');
+ yomichan().translator.dictionary.deleteDictionary(title).then(() => dict.slideUp());
+ });
+
container.find('.dict input').change(onOptionsChanged);
});
}
@@ -301,8 +308,9 @@ $(document).ready(() => {
control.trigger('input');
});
- $('#dict-import-url').on('input', () => {
- const disable = $('#dict-import-url').val().trim().length === 0;
+ const dictImportUrl = $('#dict-import-url');
+ dictImportUrl.on('input', () => {
+ const disable = dictImportUrl.val().trim().length === 0;
$('#dict-import-start').prop('disabled', disable);
});