diff options
author | Darius Jahandarie <djahandarie@gmail.com> | 2023-11-12 02:16:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-12 02:16:11 +0000 |
commit | d06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (patch) | |
tree | 93f3e15603ec38faef01070475904c08d2e9280b /ext/js/app/frontend.js | |
parent | f263e994c6eca2438eaff79cb22f1b48fe14b7b2 (diff) | |
parent | 784dcd93b02443bc253e3af43ad0586a1add39c5 (diff) |
Merge pull request #314 from starxeras/replace-yomichan
Replace all instances of yomichan
Diffstat (limited to 'ext/js/app/frontend.js')
-rw-r--r-- | ext/js/app/frontend.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index acc70667..4c13eac2 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -23,7 +23,7 @@ import {TextSourceElement} from '../dom/text-source-element.js'; import {TextSourceRange} from '../dom/text-source-range.js'; import {HotkeyHandler} from '../input/hotkey-handler.js'; import {TextScanner} from '../language/text-scanner.js'; -import {yomichan} from '../yomichan.js'; +import {yomitan} from '../yomitan.js'; import {PopupFactory} from './popup-factory.js'; import {Popup} from './popup.js'; @@ -137,7 +137,7 @@ export class Frontend { async prepare() { await this.updateOptions(); try { - const {zoomFactor} = await yomichan.api.getZoom(); + const {zoomFactor} = await yomitan.api.getZoom(); this._pageZoomFactor = zoomFactor; } catch (e) { // Ignore exceptions which may occur due to being on an unsupported page (e.g. about:blank) @@ -154,15 +154,15 @@ export class Frontend { visualViewport.addEventListener('resize', this._onVisualViewportResize.bind(this)); } - yomichan.on('optionsUpdated', this.updateOptions.bind(this)); - yomichan.on('zoomChanged', this._onZoomChanged.bind(this)); - yomichan.on('closePopups', this._onClosePopups.bind(this)); + yomitan.on('optionsUpdated', this.updateOptions.bind(this)); + yomitan.on('zoomChanged', this._onZoomChanged.bind(this)); + yomitan.on('closePopups', this._onClosePopups.bind(this)); chrome.runtime.onMessage.addListener(this._onRuntimeMessage.bind(this)); this._textScanner.on('clear', this._onTextScannerClear.bind(this)); this._textScanner.on('searched', this._onSearched.bind(this)); - yomichan.crossFrame.registerHandlers([ + yomitan.crossFrame.registerHandlers([ ['Frontend.closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}], ['Frontend.copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}], ['Frontend.getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}], @@ -208,7 +208,7 @@ export class Frontend { try { await this._updateOptionsInternal(); } catch (e) { - if (!yomichan.isExtensionUnloaded) { + if (!yomitan.isExtensionUnloaded) { throw e; } } @@ -319,7 +319,7 @@ export class Frontend { const scanningOptions = this._options.scanning; if (error !== null) { - if (yomichan.isExtensionUnloaded) { + if (yomitan.isExtensionUnloaded) { if (textSource !== null && !passive) { this._showExtensionUnloaded(textSource); } @@ -388,7 +388,7 @@ export class Frontend { async _updateOptionsInternal() { const optionsContext = await this._getOptionsContext(); - const options = await yomichan.api.optionsGet(optionsContext); + const options = await yomitan.api.optionsGet(optionsContext); const {scanning: scanningOptions, sentenceParsing: sentenceParsingOptions} = options; this._options = options; @@ -520,7 +520,7 @@ export class Frontend { return await this._getDefaultPopup(); } - const {popupId} = await yomichan.crossFrame.invoke(targetFrameId, 'Frontend.getPopupInfo'); + const {popupId} = await yomitan.crossFrame.invoke(targetFrameId, 'Frontend.getPopupInfo'); if (popupId === null) { return null; } @@ -559,7 +559,7 @@ export class Frontend { try { return this._popup !== null && await this._popup.containsPoint(x, y); } catch (e) { - if (!yomichan.isExtensionUnloaded) { + if (!yomitan.isExtensionUnloaded) { throw e; } return false; @@ -625,7 +625,7 @@ export class Frontend { Promise.resolve() ); this._lastShowPromise.catch((error) => { - if (yomichan.isExtensionUnloaded) { return; } + if (yomitan.isExtensionUnloaded) { return; } log.error(error); }); return this._lastShowPromise; @@ -677,9 +677,9 @@ export class Frontend { _signalFrontendReady(targetFrameId=null) { const params = {frameId: this._frameId}; if (targetFrameId === null) { - yomichan.api.broadcastTab('frontendReady', params); + yomitan.api.broadcastTab('frontendReady', params); } else { - yomichan.api.sendMessageToFrame(targetFrameId, 'frontendReady', params); + yomitan.api.sendMessageToFrame(targetFrameId, 'frontendReady', params); } } @@ -716,7 +716,7 @@ export class Frontend { } chrome.runtime.onMessage.addListener(onMessage); - yomichan.api.broadcastTab('Frontend.requestReadyBroadcast', {frameId: this._frameId}); + yomitan.api.broadcastTab('Frontend.requestReadyBroadcast', {frameId: this._frameId}); }); } @@ -742,7 +742,7 @@ export class Frontend { let documentTitle = document.title; if (this._useProxyPopup) { try { - ({url, documentTitle} = await yomichan.crossFrame.invoke(this._parentFrameId, 'Frontend.getPageInfo', {})); + ({url, documentTitle} = await yomitan.crossFrame.invoke(this._parentFrameId, 'Frontend.getPageInfo', {})); } catch (e) { // NOP } @@ -788,7 +788,7 @@ export class Frontend { async _prepareGoogleDocs() { if (typeof GoogleDocsUtil !== 'undefined') { return; } - await yomichan.api.loadExtensionScripts([ + await yomitan.api.loadExtensionScripts([ '/js/accessibility/google-docs-util.js' ]); if (typeof GoogleDocsUtil === 'undefined') { return; } |