summaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-01-15 12:42:44 -0800
committerAlex Yatskov <alex@foosoft.net>2017-01-15 12:42:44 -0800
commit434ccc18ee22f5dcf0298e6516adf5e8273ecb6d (patch)
treea7bda23c9c69341d7918d81408cf55adbe6c2bb2 /ext/bg/js/options-form.js
parent0c88d3fa273667d30be3ae8e1ee8da527561aa9e (diff)
dict priority work
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index af918aa6..f58c26cc 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -54,9 +54,10 @@ function getFormData() {
$('.dict-group').each((index, element) => {
const dictionary = $(element);
const title = dictionary.data('title');
+ const priority = parseInt(dictionary.find('.dict-priority').val(), 10);
const enableTerms = dictionary.find('.dict-enable-terms').prop('checked');
const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked');
- optionsNew.dictionaries[title] = {enableTerms, enableKanji};
+ optionsNew.dictionaries[title] = {priority, enableTerms, enableKanji};
});
return {optionsNew, optionsOld};
@@ -147,22 +148,23 @@ function populateDictionaries(options) {
let dictCount = 0;
return database().getDictionaries().then(rows => {
rows.forEach(row => {
- const dictoptions = options.dictionaries[row.title] || {enableTerms: false, enableKanji: false};
+ const dictOptions = options.dictionaries[row.title] || {enableTerms: false, enableKanji: false, priority: 0};
const html = Handlebars.templates['dictionary.html']({
title: row.title,
version: row.version,
revision: row.revision,
hasTerms: row.hasTerms,
hasKanji: row.hasKanji,
- enableTerms: dictoptions.enableTerms,
- enableKanji: dictoptions.enableKanji
+ priority: dictOptions.priority,
+ enableTerms: dictOptions.enableTerms,
+ enableKanji: dictOptions.enableKanji
});
dictGroups.append($(html));
++dictCount;
});
- $('.dict-enable-terms, .dict-enable-kanji').change(onOptionsChanged);
+ $('.dict-enable-terms, .dict-enable-kanji, .dict-priority').change(onOptionsChanged);
$('.dict-delete').click(onDictionaryDelete);
}).catch(error => {
showDictionaryError(error);