summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-09-14 22:34:05 -0700
committerAlex Yatskov <alex@foosoft.net>2016-09-14 22:34:05 -0700
commit0eb54e24c6c290d8aa2df1e5f6c52ae35e35ca1a (patch)
treec4881a4ddb7ac26fdc1e4956b6843727d7067aca /ext
parent07a1f94806756d96344b52fd185c2bdc0495edf6 (diff)
Deleting dead options
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/options-form.js18
-rw-r--r--ext/bg/js/options.js1
-rw-r--r--ext/bg/options.html19
-rw-r--r--ext/fg/js/frame.js27
4 files changed, 25 insertions, 40 deletions
diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js
index a1ecccda..f7d4279f 100644
--- a/ext/bg/js/options-form.js
+++ b/ext/bg/js/options-form.js
@@ -68,7 +68,6 @@ function formToOptions(section) {
case 'general':
optsNew.scanLength = parseInt($('#scan-length').val(), 10);
optsNew.activateOnStartup = $('#activate-on-startup').prop('checked');
- optsNew.loadEnamDict = $('#load-enamdict').prop('checked');
optsNew.selectMatchedText = $('#select-matched-text').prop('checked');
optsNew.showAdvancedOptions = $('#show-advanced-options').prop('checked');
optsNew.enableAudioPlayback = $('#enable-audio-playback').prop('checked');
@@ -98,9 +97,9 @@ function populateAnkiDeckAndModel(opts) {
const ankiDeck = $('.anki-deck');
ankiDeck.find('option').remove();
- yomi.api_getDeckNames({callback: (names) => {
+ yomi.api_getDeckNames({callback: names => {
if (names !== null) {
- names.forEach((name) => ankiDeck.append($('<option/>', {value: name, text: name})));
+ names.forEach(name => ankiDeck.append($('<option/>', {value: name, text: name})));
}
$('#anki-term-deck').val(opts.ankiTermDeck);
@@ -109,9 +108,9 @@ function populateAnkiDeckAndModel(opts) {
const ankiModel = $('.anki-model');
ankiModel.find('option').remove();
- yomi.api_getModelNames({callback: (names) => {
+ yomi.api_getModelNames({callback: names => {
if (names !== null) {
- names.forEach((name) => ankiModel.append($('<option/>', {value: name, text: name})));
+ names.forEach(name => ankiModel.append($('<option/>', {value: name, text: name})));
}
populateAnkiFields($('#anki-term-model').val(opts.ankiTermModel), opts);
@@ -122,7 +121,7 @@ function populateAnkiDeckAndModel(opts) {
function updateAnkiStatus() {
$('.error-dlg').hide();
- yomichan().api_getVersion({callback: (version) => {
+ yomichan().api_getVersion({callback: version => {
if (version === null) {
$('.error-dlg-connection').show();
$('.options-anki-controls').hide();
@@ -145,19 +144,19 @@ function populateAnkiFields(element, opts) {
const optKey = modelIdToFieldOptKey(modelId);
const markers = modelIdToMarkers(modelId);
- yomichan().api_getModelFieldNames({modelName, callback: (names) => {
+ yomichan().api_getModelFieldNames({modelName, callback: names => {
const table = element.closest('.tab-pane').find('.anki-fields');
table.find('tbody').remove();
const tbody = $('<tbody>');
- names.forEach((name) => {
+ names.forEach(name => {
const button = $('<button>', {type: 'button', class: 'btn btn-default dropdown-toggle'});
button.attr('data-toggle', 'dropdown').dropdown();
const markerItems = $('<ul>', {class: 'dropdown-menu dropdown-menu-right'});
for (const marker of markers) {
const link = $('<a>', {href: '#'}).text(`{${marker}}`);
- link.click((e) => {
+ link.click(e => {
e.preventDefault();
link.closest('.input-group').find('.anki-field-value').val(link.text()).trigger('change');
});
@@ -232,7 +231,6 @@ $(document).ready(() => {
loadOptions().then(opts => {
$('#scan-length').val(opts.scanLength);
$('#activate-on-startup').prop('checked', opts.activateOnStartup);
- $('#load-enamdict').prop('checked', opts.loadEnamDict);
$('#select-matched-text').prop('checked', opts.selectMatchedText);
$('#show-advanced-options').prop('checked', opts.showAdvancedOptions);
$('#enable-audio-playback').prop('checked', opts.enableAudioPlayback);
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 4c726730..6b305f2f 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -23,7 +23,6 @@ function sanitizeOptions(options) {
activateOnStartup: false,
selectMatchedText: true,
showAdvancedOptions: false,
- loadEnamDict: false,
enableAudioPlayback: true,
enableAnkiConnect: false,
ankiCardTags: ['yomichan'],
diff --git a/ext/bg/options.html b/ext/bg/options.html
index 9a2bd0e8..781257a2 100644
--- a/ext/bg/options.html
+++ b/ext/bg/options.html
@@ -28,11 +28,6 @@
<h3>General Options</h3>
<form class="form-horizontal">
- <div class="form-group options-advanced">
- <label for="scan-length" class="control-label col-sm-2">Scan length</label>
- <div class="col-sm-10"><input type="number" min="1" id="scan-length" class="form-control"></div>
- </div>
-
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
@@ -44,14 +39,6 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
- <label class="control-label"><input type="checkbox" id="load-enamdict"> Load <a href="http://www.edrdg.org/enamdict/enamdict_doc.html">ENAMDICT</a> (requires restart)</label>
- </div>
- </div>
- </div>
-
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <div class="checkbox">
<label class="control-label"><input type="checkbox" id="select-matched-text"> Select matched text</label>
</div>
</div>
@@ -73,7 +60,6 @@
</div>
</div>
-
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
@@ -81,6 +67,11 @@
</div>
</div>
</div>
+
+ <div class="form-group options-advanced">
+ <label for="scan-length" class="control-label col-sm-2">Scan length</label>
+ <div class="col-sm-10"><input type="number" min="1" id="scan-length" class="form-control"></div>
+ </div>
</form>
</div>
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index 30cb7c73..d06e8b94 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -46,19 +46,6 @@ function registerAudioLinks() {
}
}
-function onDomContentLoaded() {
- registerKanjiLinks();
- registerAddNoteLinks();
- registerAudioLinks();
-}
-
-function onMessage(e) {
- const {action, params} = e.data, method = window['api_' + action];
- if (typeof(method) === 'function') {
- method(params);
- }
-}
-
function api_setActionState({index, state, sequence}) {
for (const mode in state) {
const matches = document.querySelectorAll(`.action-bar[data-sequence="${sequence}"] .action-add-note[data-index="${index}"][data-mode="${mode}"]`);
@@ -75,5 +62,15 @@ function api_setActionState({index, state, sequence}) {
}
}
-document.addEventListener('DOMContentLoaded', onDomContentLoaded, false);
-window.addEventListener('message', onMessage);
+document.addEventListener('DOMContentLoaded', () => {
+ registerKanjiLinks();
+ registerAddNoteLinks();
+ registerAudioLinks();
+});
+
+window.addEventListener('message', () => {
+ const {action, params} = e.data, method = window['api_' + action];
+ if (typeof(method) === 'function') {
+ method(params);
+ }
+});