aboutsummaryrefslogtreecommitdiff
path: root/ext/js/app
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/app')
-rw-r--r--ext/js/app/content-script-main.js8
-rw-r--r--ext/js/app/frontend.js34
-rw-r--r--ext/js/app/popup-factory.js6
-rw-r--r--ext/js/app/popup-proxy.js6
-rw-r--r--ext/js/app/popup-window.js14
-rw-r--r--ext/js/app/popup.js10
6 files changed, 39 insertions, 39 deletions
diff --git a/ext/js/app/content-script-main.js b/ext/js/app/content-script-main.js
index d5ae0d93..a042f3bf 100644
--- a/ext/js/app/content-script-main.js
+++ b/ext/js/app/content-script-main.js
@@ -18,15 +18,15 @@
import {log} from '../core.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {Frontend} from './frontend.js';
import {PopupFactory} from './popup-factory.js';
(async () => {
try {
- await yomichan.prepare();
+ await yomitan.prepare();
- const {tabId, frameId} = await yomichan.api.frameInformationGet();
+ const {tabId, frameId} = await yomitan.api.frameInformationGet();
if (typeof frameId !== 'number') {
throw new Error('Failed to get frameId');
}
@@ -51,7 +51,7 @@ import {PopupFactory} from './popup-factory.js';
});
await frontend.prepare();
- yomichan.ready();
+ yomitan.ready();
} catch (e) {
log.error(e);
}
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; }
diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js
index 7a17c106..e871f7ec 100644
--- a/ext/js/app/popup-factory.js
+++ b/ext/js/app/popup-factory.js
@@ -18,7 +18,7 @@
import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
import {generateId} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {PopupProxy} from './popup-proxy.js';
import {PopupWindow} from './popup-window.js';
import {Popup} from './popup.js';
@@ -43,7 +43,7 @@ export class PopupFactory {
*/
prepare() {
this._frameOffsetForwarder.prepare();
- yomichan.crossFrame.registerHandlers([
+ yomitan.crossFrame.registerHandlers([
['PopupFactory.getOrCreatePopup', {async: true, handler: this._onApiGetOrCreatePopup.bind(this)}],
['PopupFactory.setOptionsContext', {async: true, handler: this._onApiSetOptionsContext.bind(this)}],
['PopupFactory.hide', {async: false, handler: this._onApiHide.bind(this)}],
@@ -151,7 +151,7 @@ export class PopupFactory {
throw new Error('Invalid frameId');
}
const useFrameOffsetForwarder = (parentPopupId === null);
- ({id, depth, frameId} = await yomichan.crossFrame.invoke(frameId, 'PopupFactory.getOrCreatePopup', {
+ ({id, depth, frameId} = await yomitan.crossFrame.invoke(frameId, 'PopupFactory.getOrCreatePopup', {
id,
parentPopupId,
frameId,
diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js
index d16a16f1..3d8b55ba 100644
--- a/ext/js/app/popup-proxy.js
+++ b/ext/js/app/popup-proxy.js
@@ -18,7 +18,7 @@
import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
import {EventDispatcher, log} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {Popup} from './popup.js';
/**
@@ -294,14 +294,14 @@ export class PopupProxy extends EventDispatcher {
// Private
_invoke(action, params={}) {
- return yomichan.crossFrame.invoke(this._frameId, action, params);
+ return yomitan.crossFrame.invoke(this._frameId, action, params);
}
async _invokeSafe(action, params={}, defaultReturnValue) {
try {
return await this._invoke(action, params);
} catch (e) {
- if (!yomichan.isExtensionUnloaded) { throw e; }
+ if (!yomitan.isExtensionUnloaded) { throw e; }
return defaultReturnValue;
}
}
diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js
index b5fd9eb6..88370684 100644
--- a/ext/js/app/popup-window.js
+++ b/ext/js/app/popup-window.js
@@ -17,7 +17,7 @@
*/
import {EventDispatcher} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {Popup} from './popup.js';
/**
@@ -138,7 +138,7 @@ export class PopupWindow extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the popup is visible, `false` otherwise.
*/
async isVisible() {
- return (this._popupTabId !== null && await yomichan.api.isTabSearchPopup(this._popupTabId));
+ return (this._popupTabId !== null && await yomitan.api.isTabSearchPopup(this._popupTabId));
}
/**
@@ -263,16 +263,16 @@ export class PopupWindow extends EventDispatcher {
// Private
async _invoke(open, action, params={}, defaultReturnValue) {
- if (yomichan.isExtensionUnloaded) {
+ if (yomitan.isExtensionUnloaded) {
return defaultReturnValue;
}
const frameId = 0;
if (this._popupTabId !== null) {
try {
- return await yomichan.crossFrame.invokeTab(this._popupTabId, frameId, 'popupMessage', {action, params});
+ return await yomitan.crossFrame.invokeTab(this._popupTabId, frameId, 'popupMessage', {action, params});
} catch (e) {
- if (yomichan.isExtensionUnloaded) {
+ if (yomitan.isExtensionUnloaded) {
open = false;
}
}
@@ -283,9 +283,9 @@ export class PopupWindow extends EventDispatcher {
return defaultReturnValue;
}
- const {tabId} = await yomichan.api.getOrCreateSearchPopup({focus: 'ifCreated'});
+ const {tabId} = await yomitan.api.getOrCreateSearchPopup({focus: 'ifCreated'});
this._popupTabId = tabId;
- return await yomichan.crossFrame.invokeTab(this._popupTabId, frameId, 'popupMessage', {action, params});
+ return await yomitan.crossFrame.invokeTab(this._popupTabId, frameId, 'popupMessage', {action, params});
}
}
diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js
index 90f73847..0e2e2493 100644
--- a/ext/js/app/popup.js
+++ b/ext/js/app/popup.js
@@ -20,7 +20,7 @@ import {FrameClient} from '../comm/frame-client.js';
import {DynamicProperty, EventDispatcher, EventListenerCollection, deepEqual} from '../core.js';
import {DocumentUtil} from '../dom/document-util.js';
import {dynamicLoader} from '../script/dynamic-loader.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {ThemeController} from './theme-controller.js';
/**
@@ -208,7 +208,7 @@ export class Popup extends EventDispatcher {
this._frame.addEventListener('scroll', (e) => e.stopPropagation());
this._frame.addEventListener('load', this._onFrameLoad.bind(this));
this._visible.on('change', this._onVisibleChange.bind(this));
- yomichan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
+ yomitan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
this._onVisibleChange({value: this.isVisibleSync()});
this._themeController.prepare();
}
@@ -626,14 +626,14 @@ export class Popup extends EventDispatcher {
if (this._frameClient === null || !this._frameClient.isConnected() || contentWindow === null) { return; }
const message = this._frameClient.createMessage({action, params});
- return await yomichan.crossFrame.invoke(this._frameClient.frameId, 'popupMessage', message);
+ return await yomitan.crossFrame.invoke(this._frameClient.frameId, 'popupMessage', message);
}
async _invokeSafe(action, params={}, defaultReturnValue) {
try {
return await this._invoke(action, params);
} catch (e) {
- if (!yomichan.isExtensionUnloaded) { throw e; }
+ if (!yomitan.isExtensionUnloaded) { throw e; }
return defaultReturnValue;
}
}
@@ -884,7 +884,7 @@ export class Popup extends EventDispatcher {
async _setOptionsContext(optionsContext) {
this._optionsContext = optionsContext;
- const options = await yomichan.api.optionsGet(optionsContext);
+ const options = await yomitan.api.optionsGet(optionsContext);
const {general} = options;
this._themeController.theme = general.popupTheme;
this._themeController.outerTheme = general.popupOuterTheme;