aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-08-18 20:24:27 -0700
committerAlex Yatskov <alex@foosoft.net>2016-08-18 20:24:27 -0700
commitc5a7020e2166df44db75c086099363580801de6e (patch)
tree4682ec92c83f388d51ff85cb0847fdc22f78a9cb /ext/bg/js
parentb1851c971c3a1fea877f2dc442b223b5d2444775 (diff)
WIP
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/options-form.js14
-rw-r--r--ext/bg/js/options.js26
2 files changed, 20 insertions, 20 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index cd0c1ab8..62c5e7b2 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -37,7 +37,7 @@ function modelIdToFieldOptKey(id) {
}[id];
}
-function modelIdToTags(id) {
+function modelIdToMarkers(id) {
return {
'anki-term-model': ['audio', 'expression', 'glossary', 'glossary-list', 'reading', 'sentence', 'tags', 'url'],
'anki-kanji-model': ['character', 'glossary', 'glossary-list', 'kunyomi', 'onyomi', 'url'],
@@ -124,7 +124,7 @@ function populateAnkiFields(element, opts) {
const modelId = element.attr('id');
const optKey = modelIdToFieldOptKey(modelId);
- const tags = modelIdToTags(modelId);
+ const markers = modelIdToMarkers(modelId);
yomichan().api_getModelFieldNames({modelName, callback: (names) => {
const table = element.closest('.tab-pane').find('.anki-fields');
@@ -135,19 +135,19 @@ function populateAnkiFields(element, opts) {
const button = $('<button>', {type: 'button', class: 'btn btn-default dropdown-toggle'});
button.attr('data-toggle', 'dropdown').dropdown();
- const tagItems = $('<ul>', {class: 'dropdown-menu dropdown-menu-right'});
- for (const tag of tags) {
- const link = $('<a>', {href: '#'}).text(`{${tag}}`);
+ const markerItems = $('<ul>', {class: 'dropdown-menu dropdown-menu-right'});
+ for (const marker of markers) {
+ const link = $('<a>', {href: '#'}).text(`{${marker}}`);
link.click((e) => {
e.preventDefault();
link.closest('.input-group').find('.anki-field-value').val(link.text()).trigger('change');
});
- tagItems.append($('<li>').append(link));
+ markerItems.append($('<li>').append(link));
}
const groupBtn = $('<div>', {class: 'input-group-btn'});
groupBtn.append(button.append($('<span>', {class: 'caret'})));
- groupBtn.append(tagItems);
+ groupBtn.append(markerItems);
const group = $('<div>', {class: 'input-group'});
group.append($('<input>', {type: 'text', class: 'anki-field-value form-control', value: opts[optKey][name] || ''}).data('field', name).change(onOptionsAnkiChanged));
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index a1c169a7..8a6f633a 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -19,21 +19,21 @@
function sanitizeOptions(options) {
const defaults = {
- scanLength: 20,
- activateOnStartup: false,
- selectMatchedText: true,
+ scanLength: 20,
+ activateOnStartup: false,
+ selectMatchedText: true,
showAdvancedOptions: false,
- loadEnamDict: false,
+ loadEnamDict: false,
enableAudioPlayback: true,
- enableAnkiConnect: false,
- ankiCardTags: ['yomichan'],
- sentenceExtent: 200,
- ankiTermDeck: options.ankiVocabDeck || '',
- ankiTermModel: options.ankiVocabModel || '',
- ankiTermFields: options.ankiVocabFields || {},
- ankiKanjiDeck: '',
- ankiKanjiModel: '',
- ankiKanjiFields: {}
+ enableAnkiConnect: false,
+ ankiCardTags: ['yomichan'],
+ sentenceExtent: 200,
+ ankiTermDeck: options.ankiVocabDeck || '',
+ ankiTermModel: options.ankiVocabModel || '',
+ ankiTermFields: options.ankiVocabFields || {},
+ ankiKanjiDeck: '',
+ ankiKanjiModel: '',
+ ankiKanjiFields: {}
};
for (const key in defaults) {