aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/options-form.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-05-22 16:53:28 -0700
committerAlex Yatskov <alex@foosoft.net>2016-05-22 16:53:28 -0700
commitbd17b05eef0691f3f5ea618abb33da529e022dfd (patch)
tree8aa6f4ade205c6c4e5e50037ea477f574a4815a2 /ext/bg/js/options-form.js
parentca13c947bb753445b87ec138d113e5b91e1963ef (diff)
Cleanup
Diffstat (limited to 'ext/bg/js/options-form.js')
-rw-r--r--ext/bg/js/options-form.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index 06be044a..1aa26384 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -22,20 +22,20 @@ function yomichan() {
}
function optionsToForm(opts) {
- $('#activateOnStartup').prop('checked', opts.activateOnStartup);
- $('#enableAnkiConnect').prop('checked', opts.enableAnkiConnect);
- $('#loadEnamDict').prop('checked', opts.loadEnamDict);
- $('#scanLength').val(opts.scanLength);
- $('#selectMatchedText').prop('checked', opts.selectMatchedText);
+ $('#activate-on-startup').prop('checked', opts.activateOnStartup);
+ $('#enable-anki-connect').prop('checked', opts.enableAnkiConnect);
+ $('#load-enamdict').prop('checked', opts.loadEnamDict);
+ $('#scan-length').val(opts.scanLength);
+ $('#select-matched-text').prop('checked', opts.selectMatchedText);
}
function formToOptions() {
return sanitizeOptions({
- activateOnStartup: $('#activateOnStartup').prop('checked'),
- enableAnkiConnect: $('#enableAnkiConnect').prop('checked'),
- loadEnamDict: $('#loadEnamDict').prop('checked'),
- scanLength: $('#scanLength').val(),
- selectMatchedText: $('#selectMatchedText').prop('checked')
+ activateOnStartup: $('#activate-on-startup').prop('checked'),
+ enableAnkiConnect: $('#enable-anki-connect').prop('checked'),
+ loadEnamDict: $('#load-enamdict').prop('checked'),
+ scanLength: $('#scan-length').val(),
+ selectMatchedText: $('#select-matched-text').prop('checked')
});
}
@@ -51,7 +51,7 @@ function updateAnkiFormVis(opts) {
function populateAnkiDeckAndModel() {
const yomi = yomichan();
- const ankiDeck = $('.ankiDeck');
+ const ankiDeck = $('.anki-deck');
ankiDeck.find('option').remove();
yomi.api_getDeckNames({callback: (names) => {
if (names !== null) {
@@ -59,12 +59,12 @@ function populateAnkiDeckAndModel() {
}
}});
- const ankiModel = $('.ankiModel');
+ const ankiModel = $('.anki-model');
ankiModel.find('option').remove();
yomi.api_getModelNames({callback: (names) => {
if (names !== null) {
names.forEach((name) => ankiModel.append($('<option/>', {value: name, text: name})));
- $('.ankiModel').trigger('change');
+ $('.anki-model').trigger('change');
}
}});
@@ -85,14 +85,14 @@ function onModelChanged() {
}
yomichan().api_getModelFieldNames({modelName, callback: (names) => {
- const table = $(this).closest('.tab-pane').find('.ankiFields');
+ const table = $(this).closest('.tab-pane').find('.anki-fields');
table.find('tbody').remove();
const body = $('<tbody>');
names.forEach((name) => {
const row = $('<tr>');
row.append($('<td>').text(name));
- row.append($('<input>', {class: 'ankiFieldValue form-control'}).data('field', name));
+ row.append($('<input>', {class: 'anki-field-value form-control'}).data('field', name));
body.append(row);
});
@@ -105,7 +105,7 @@ $(document).ready(() => {
optionsToForm(opts);
$('input').on('input paste change', onOptionsChanged);
- $('.ankiModel').change(onModelChanged);
+ $('.anki-model').change(onModelChanged);
updateAnkiFormVis(opts);
});