Use functions directly rather than wrapping in () => {} when args are same

This commit is contained in:
toasted-nutbread 2020-02-26 21:17:01 -05:00
parent 8bc1a40914
commit 2d109c3e56
7 changed files with 28 additions and 28 deletions

View File

@ -45,10 +45,10 @@ function ankiTemplatesInitialize() {
node.addEventListener('click', onAnkiTemplateMarkerClicked, false); node.addEventListener('click', onAnkiTemplateMarkerClicked, false);
} }
$('#field-templates').on('change', (e) => onAnkiFieldTemplatesChanged(e)); $('#field-templates').on('change', onAnkiFieldTemplatesChanged);
$('#field-template-render').on('click', (e) => onAnkiTemplateRender(e)); $('#field-template-render').on('click', onAnkiTemplateRender);
$('#field-templates-reset').on('click', (e) => onAnkiFieldTemplatesReset(e)); $('#field-templates-reset').on('click', onAnkiFieldTemplatesReset);
$('#field-templates-reset-confirm').on('click', (e) => onAnkiFieldTemplatesResetConfirm(e)); $('#field-templates-reset-confirm').on('click', onAnkiFieldTemplatesResetConfirm);
ankiTemplatesUpdateValue(); ankiTemplatesUpdateValue();
} }

View File

@ -154,10 +154,10 @@ async function _ankiFieldsPopulate(tabId, options) {
container.appendChild(fragment); container.appendChild(fragment);
for (const node of container.querySelectorAll('.anki-field-value')) { for (const node of container.querySelectorAll('.anki-field-value')) {
node.addEventListener('change', (e) => onFormOptionsChanged(e), false); node.addEventListener('change', onFormOptionsChanged, false);
} }
for (const node of container.querySelectorAll('.marker-link')) { for (const node of container.querySelectorAll('.marker-link')) {
node.addEventListener('click', (e) => _onAnkiMarkerClicked(e), false); node.addEventListener('click', _onAnkiMarkerClicked, false);
} }
} }
@ -267,7 +267,7 @@ function ankiGetFieldMarkers(type) {
function ankiInitialize() { function ankiInitialize() {
for (const node of document.querySelectorAll('#anki-terms-model,#anki-kanji-model')) { for (const node of document.querySelectorAll('#anki-terms-model,#anki-kanji-model')) {
node.addEventListener('change', (e) => _onAnkiModelChanged(e), false); node.addEventListener('change', _onAnkiModelChanged, false);
} }
} }

View File

@ -29,7 +29,7 @@ async function audioSettingsInitialize() {
document.querySelector('.audio-source-list'), document.querySelector('.audio-source-list'),
document.querySelector('.audio-source-add') document.querySelector('.audio-source-add')
); );
audioSourceUI.save = () => settingsSaveOptions(); audioSourceUI.save = settingsSaveOptions;
textToSpeechInitialize(); textToSpeechInitialize();
} }
@ -37,11 +37,11 @@ async function audioSettingsInitialize() {
function textToSpeechInitialize() { function textToSpeechInitialize() {
if (typeof speechSynthesis === 'undefined') { return; } if (typeof speechSynthesis === 'undefined') { return; }
speechSynthesis.addEventListener('voiceschanged', () => updateTextToSpeechVoices(), false); speechSynthesis.addEventListener('voiceschanged', updateTextToSpeechVoices, false);
updateTextToSpeechVoices(); updateTextToSpeechVoices();
document.querySelector('#text-to-speech-voice').addEventListener('change', (e) => onTextToSpeechVoiceChange(e), false); document.querySelector('#text-to-speech-voice').addEventListener('change', onTextToSpeechVoiceChange, false);
document.querySelector('#text-to-speech-voice-test').addEventListener('click', () => textToSpeechTest(), false); document.querySelector('#text-to-speech-voice-test').addEventListener('click', textToSpeechTest, false);
} }
function updateTextToSpeechVoices() { function updateTextToSpeechVoices() {

View File

@ -341,14 +341,14 @@ async function dictSettingsInitialize() {
document.querySelector('#dict-groups-extra'), document.querySelector('#dict-groups-extra'),
document.querySelector('#dict-extra-template') document.querySelector('#dict-extra-template')
); );
dictionaryUI.save = () => settingsSaveOptions(); dictionaryUI.save = settingsSaveOptions;
document.querySelector('#dict-purge-button').addEventListener('click', (e) => onDictionaryPurgeButtonClick(e), false); document.querySelector('#dict-purge-button').addEventListener('click', onDictionaryPurgeButtonClick, false);
document.querySelector('#dict-purge-confirm').addEventListener('click', (e) => onDictionaryPurge(e), false); document.querySelector('#dict-purge-confirm').addEventListener('click', onDictionaryPurge, false);
document.querySelector('#dict-file-button').addEventListener('click', (e) => onDictionaryImportButtonClick(e), false); document.querySelector('#dict-file-button').addEventListener('click', onDictionaryImportButtonClick, false);
document.querySelector('#dict-file').addEventListener('change', (e) => onDictionaryImport(e), false); document.querySelector('#dict-file').addEventListener('change', onDictionaryImport, false);
document.querySelector('#dict-main').addEventListener('change', (e) => onDictionaryMainChanged(e), false); document.querySelector('#dict-main').addEventListener('change', onDictionaryMainChanged, false);
document.querySelector('#database-enable-prefix-wildcard-searches').addEventListener('change', (e) => onDatabaseEnablePrefixWildcardSearchesChanged(e), false); document.querySelector('#database-enable-prefix-wildcard-searches').addEventListener('change', onDatabaseEnablePrefixWildcardSearchesChanged, false);
await onDictionaryOptionsChanged(); await onDictionaryOptionsChanged();
await onDatabaseUpdated(); await onDatabaseUpdated();

View File

@ -200,7 +200,7 @@ async function formWrite(options) {
} }
function formSetupEventListeners() { function formSetupEventListeners() {
$('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change((e) => onFormOptionsChanged(e)); $('input, select, textarea').not('.anki-model').not('.ignore-form-changes *').change(onFormOptionsChanged);
} }
function formUpdateVisibility(options) { function formUpdateVisibility(options) {

View File

@ -39,16 +39,16 @@ async function profileOptionsSetup() {
} }
function profileOptionsSetupEventListeners() { function profileOptionsSetupEventListeners() {
$('#profile-target').change((e) => onTargetProfileChanged(e)); $('#profile-target').change(onTargetProfileChanged);
$('#profile-name').change((e) => onProfileNameChanged(e)); $('#profile-name').change(onProfileNameChanged);
$('#profile-add').click((e) => onProfileAdd(e)); $('#profile-add').click(onProfileAdd);
$('#profile-remove').click((e) => onProfileRemove(e)); $('#profile-remove').click(onProfileRemove);
$('#profile-remove-confirm').click((e) => onProfileRemoveConfirm(e)); $('#profile-remove-confirm').click(onProfileRemoveConfirm);
$('#profile-copy').click((e) => onProfileCopy(e)); $('#profile-copy').click(onProfileCopy);
$('#profile-copy-confirm').click((e) => onProfileCopyConfirm(e)); $('#profile-copy-confirm').click(onProfileCopyConfirm);
$('#profile-move-up').click(() => onProfileMove(-1)); $('#profile-move-up').click(() => onProfileMove(-1));
$('#profile-move-down').click(() => onProfileMove(1)); $('#profile-move-down').click(() => onProfileMove(1));
$('.profile-form').find('input, select, textarea').not('.profile-form-manual').change((e) => onProfileOptionsChanged(e)); $('.profile-form').find('input, select, textarea').not('.profile-form-manual').change(onProfileOptionsChanged);
} }
function tryGetIntegerValue(selector, min, max) { function tryGetIntegerValue(selector, min, max) {

View File

@ -57,7 +57,7 @@ async function storageInfoInitialize() {
await storageShowInfo(); await storageShowInfo();
document.querySelector('#storage-refresh').addEventListener('click', () => storageShowInfo(), false); document.querySelector('#storage-refresh').addEventListener('click', storageShowInfo, false);
} }
async function storageUpdateStats() { async function storageUpdateStats() {