diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/backend.js | 6 | ||||
-rw-r--r-- | ext/bg/js/search.js | 14 | ||||
-rw-r--r-- | ext/bg/js/settings/audio-ui.js | 6 | ||||
-rw-r--r-- | ext/bg/js/settings/conditions-ui.js | 12 | ||||
-rw-r--r-- | ext/bg/js/settings/dictionaries.js | 10 | ||||
-rw-r--r-- | ext/bg/js/settings/popup-preview-frame.js | 6 | ||||
-rw-r--r-- | ext/fg/js/float.js | 4 | ||||
-rw-r--r-- | ext/fg/js/frontend.js | 6 | ||||
-rw-r--r-- | ext/fg/js/popup.js | 2 | ||||
-rw-r--r-- | ext/mixed/js/scroll.js | 2 |
10 files changed, 34 insertions, 34 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 25537e55..238ac52c 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -100,10 +100,10 @@ class Backend { this.onOptionsUpdated('background'); if (isObject(chrome.commands) && isObject(chrome.commands.onCommand)) { - chrome.commands.onCommand.addListener((command) => this._runCommand(command)); + chrome.commands.onCommand.addListener(this._runCommand.bind(this)); } if (isObject(chrome.tabs) && isObject(chrome.tabs.onZoomChange)) { - chrome.tabs.onZoomChange.addListener((info) => this._onZoomChange(info)); + chrome.tabs.onZoomChange.addListener(this._onZoomChange.bind(this)); } chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); @@ -116,7 +116,7 @@ class Backend { this.isPreparedResolve = null; this.isPreparedPromise = null; - this.clipboardMonitor.onClipboardText = (text) => this._onClipboardText(text); + this.clipboardMonitor.onClipboardText = this._onClipboardText.bind(this); } onOptionsUpdated(source) { diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index c692a859..e9b1918b 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -93,18 +93,18 @@ class DisplaySearch extends Display { } else { this.clipboardMonitorEnable.checked = false; } - this.clipboardMonitorEnable.addEventListener('change', (e) => this.onClipboardMonitorEnableChange(e)); + this.clipboardMonitorEnable.addEventListener('change', this.onClipboardMonitorEnableChange.bind(this)); } chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); - this.search.addEventListener('click', (e) => this.onSearch(e), false); - this.query.addEventListener('input', () => this.onSearchInput(), false); - this.wanakanaEnable.addEventListener('change', (e) => this.onWanakanaEnableChange(e)); - window.addEventListener('popstate', (e) => this.onPopState(e)); - window.addEventListener('copy', (e) => this.onCopy(e)); + this.search.addEventListener('click', this.onSearch.bind(this), false); + this.query.addEventListener('input', this.onSearchInput.bind(this), false); + this.wanakanaEnable.addEventListener('change', this.onWanakanaEnableChange.bind(this)); + window.addEventListener('popstate', this.onPopState.bind(this)); + window.addEventListener('copy', this.onCopy.bind(this)); - this.clipboardMonitor.onClipboardText = (text) => this.onExternalSearchUpdate(text); + this.clipboardMonitor.onClipboardText = this.onExternalSearchUpdate.bind(this); this.updateSearchButton(); } catch (e) { diff --git a/ext/bg/js/settings/audio-ui.js b/ext/bg/js/settings/audio-ui.js index 555380b4..206539a4 100644 --- a/ext/bg/js/settings/audio-ui.js +++ b/ext/bg/js/settings/audio-ui.js @@ -37,7 +37,7 @@ AudioSourceUI.Container = class Container { this.children.push(new AudioSourceUI.AudioSource(this, audioSource, this.children.length)); } - this._clickListener = () => this.onAddAudioSource(); + this._clickListener = this.onAddAudioSource.bind(this); this.addButton.addEventListener('click', this._clickListener, false); } @@ -105,8 +105,8 @@ AudioSourceUI.AudioSource = class AudioSource { this.select.value = audioSource; - this._selectChangeListener = () => this.onSelectChanged(); - this._removeClickListener = () => this.onRemoveClicked(); + this._selectChangeListener = this.onSelectChanged.bind(this); + this._removeClickListener = this.onRemoveClicked.bind(this); this.select.addEventListener('change', this._selectChangeListener, false); this.removeButton.addEventListener('click', this._removeClickListener, false); diff --git a/ext/bg/js/settings/conditions-ui.js b/ext/bg/js/settings/conditions-ui.js index 63e01861..4ca86b07 100644 --- a/ext/bg/js/settings/conditions-ui.js +++ b/ext/bg/js/settings/conditions-ui.js @@ -41,7 +41,7 @@ ConditionsUI.Container = class Container { this.children.push(new ConditionsUI.ConditionGroup(this, conditionGroup)); } - this.addButton.on('click', () => this.onAddConditionGroup()); + this.addButton.on('click', this.onAddConditionGroup.bind(this)); } cleanup() { @@ -127,7 +127,7 @@ ConditionsUI.ConditionGroup = class ConditionGroup { this.children.push(new ConditionsUI.Condition(this, condition)); } - this.addButton.on('click', () => this.onAddCondition()); + this.addButton.on('click', this.onAddCondition.bind(this)); } cleanup() { @@ -185,10 +185,10 @@ ConditionsUI.Condition = class Condition { this.updateOperators(); this.updateInput(); - this.input.on('change', () => this.onInputChanged()); - this.typeSelect.on('change', () => this.onConditionTypeChanged()); - this.operatorSelect.on('change', () => this.onConditionOperatorChanged()); - this.removeButton.on('click', () => this.onRemoveClicked()); + this.input.on('change', this.onInputChanged.bind(this)); + this.typeSelect.on('change', this.onConditionTypeChanged.bind(this)); + this.operatorSelect.on('change', this.onConditionOperatorChanged.bind(this)); + this.removeButton.on('click', this.onRemoveClicked.bind(this)); } cleanup() { diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js index 70a22a16..3ceb12fa 100644 --- a/ext/bg/js/settings/dictionaries.js +++ b/ext/bg/js/settings/dictionaries.js @@ -36,7 +36,7 @@ class SettingsDictionaryListUI { this.dictionaryEntries = []; this.extra = null; - document.querySelector('#dict-delete-confirm').addEventListener('click', (e) => this.onDictionaryConfirmDelete(e), false); + document.querySelector('#dict-delete-confirm').addEventListener('click', this.onDictionaryConfirmDelete.bind(this), false); } setOptionsDictionaries(optionsDictionaries) { @@ -198,10 +198,10 @@ class SettingsDictionaryEntryUI { this.applyValues(); - this.eventListeners.addEventListener(this.enabledCheckbox, 'change', (e) => this.onEnabledChanged(e), false); - this.eventListeners.addEventListener(this.allowSecondarySearchesCheckbox, 'change', (e) => this.onAllowSecondarySearchesChanged(e), false); - this.eventListeners.addEventListener(this.priorityInput, 'change', (e) => this.onPriorityChanged(e), false); - this.eventListeners.addEventListener(this.deleteButton, 'click', (e) => this.onDeleteButtonClicked(e), false); + this.eventListeners.addEventListener(this.enabledCheckbox, 'change', this.onEnabledChanged.bind(this), false); + this.eventListeners.addEventListener(this.allowSecondarySearchesCheckbox, 'change', this.onAllowSecondarySearchesChanged.bind(this), false); + this.eventListeners.addEventListener(this.priorityInput, 'change', this.onPriorityChanged.bind(this), false); + this.eventListeners.addEventListener(this.deleteButton, 'click', this.onDeleteButtonClicked.bind(this), false); } cleanup() { diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index d0336b5e..4c086bcd 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -44,7 +44,7 @@ class SettingsPopupPreview { async prepare() { // Setup events - window.addEventListener('message', (e) => this.onMessage(e), false); + window.addEventListener('message', this.onMessage.bind(this), false); const themeDarkCheckbox = document.querySelector('#theme-dark-checkbox'); if (themeDarkCheckbox !== null) { @@ -52,7 +52,7 @@ class SettingsPopupPreview { } // Overwrite API functions - window.apiOptionsGet = (...args) => this.apiOptionsGet(...args); + window.apiOptionsGet = this.apiOptionsGet.bind(this); // Overwrite frontend const popupHost = new PopupProxyHost(); @@ -62,7 +62,7 @@ class SettingsPopupPreview { this.popup.setChildrenSupported(false); this.popupSetCustomOuterCssOld = this.popup.setCustomOuterCss; - this.popup.setCustomOuterCss = (...args) => this.popupSetCustomOuterCss(...args); + this.popup.setCustomOuterCss = this.popupSetCustomOuterCss.bind(this); this.frontend = new Frontend(this.popup); diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index 7cc9c367..aef0367e 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -51,8 +51,8 @@ class DisplayFloat extends Display { ['setContentScale', ({scale}) => this.setContentScale(scale)] ]); - yomichan.on('orphaned', () => this.onOrphaned()); - window.addEventListener('message', (e) => this.onMessage(e), false); + yomichan.on('orphaned', this.onOrphaned.bind(this)); + window.addEventListener('message', this.onMessage.bind(this), false); } async prepare(options, popupInfo, url, childrenSupported, scale, uniqueId) { diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 71ca7c9e..929ab56a 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -64,9 +64,9 @@ class Frontend extends TextScanner { window.visualViewport.addEventListener('resize', this.onVisualViewportResize.bind(this)); } - yomichan.on('orphaned', () => this.onOrphaned()); - yomichan.on('optionsUpdated', () => this.updateOptions()); - yomichan.on('zoomChanged', (e) => this.onZoomChanged(e)); + yomichan.on('orphaned', this.onOrphaned.bind(this)); + yomichan.on('optionsUpdated', this.updateOptions.bind(this)); + yomichan.on('zoomChanged', this.onZoomChanged.bind(this)); chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); this._updateContentScale(); diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 4927f4bd..bc40a8c4 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -260,7 +260,7 @@ class Popup { 'mozfullscreenchange', 'webkitfullscreenchange' ]; - const onFullscreenChanged = () => this._onFullscreenChanged(); + const onFullscreenChanged = this._onFullscreenChanged.bind(this); for (const eventName of fullscreenEvents) { this._fullscreenEventListeners.addEventListener(document, eventName, onFullscreenChanged, false); } diff --git a/ext/mixed/js/scroll.js b/ext/mixed/js/scroll.js index 5829d294..72da8b65 100644 --- a/ext/mixed/js/scroll.js +++ b/ext/mixed/js/scroll.js @@ -26,7 +26,7 @@ class WindowScroll { this.animationEndTime = 0; this.animationEndX = 0; this.animationEndY = 0; - this.requestAnimationFrameCallback = (t) => this.onAnimationFrame(t); + this.requestAnimationFrameCallback = this.onAnimationFrame.bind(this); } toY(y) { |