aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background
diff options
context:
space:
mode:
authorstarxeras <starxeras@gmail.com>2023-11-10 19:48:27 -0600
committerstarxeras <starxeras@gmail.com>2023-11-10 19:48:27 -0600
commitc4134168be8bf8df4e7ba4860e3d99b3c2256734 (patch)
treed397833c6d7aca11b9fa452d80f0c61089f59b64 /ext/js/background
parentdae82459073c18c903c0bb54c578476ed83dbfd8 (diff)
`yomichan` -> `yomitan`
Diffstat (limited to 'ext/js/background')
-rw-r--r--ext/js/background/backend.js34
-rw-r--r--ext/js/background/background-main.js4
-rw-r--r--ext/js/background/offscreen.js6
3 files changed, 22 insertions, 22 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index cccfcbb3..e4186d02 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -34,7 +34,7 @@ import {JapaneseUtil} from '../language/sandbox/japanese-util.js';
import {Translator} from '../language/translator.js';
import {AudioDownloader} from '../media/audio-downloader.js';
import {MediaUtil} from '../media/media-util.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {ProfileConditionsUtil} from './profile-conditions-util.js';
import {RequestBuilder} from './request-builder.js';
import {ScriptManager} from './script-manager.js';
@@ -225,7 +225,7 @@ export class Backend {
}, 1000);
this._updateBadge();
- yomichan.on('log', this._onLog.bind(this));
+ yomitan.on('log', this._onLog.bind(this));
await this._requestBuilder.prepare();
await this._environment.prepare();
@@ -256,8 +256,8 @@ export class Backend {
this._clipboardMonitor.on('change', this._onClipboardTextChange.bind(this));
- this._sendMessageAllTabsIgnoreResponse('Yomichan.backendReady', {});
- this._sendMessageIgnoreResponse({action: 'Yomichan.backendReady', params: {}});
+ this._sendMessageAllTabsIgnoreResponse('Yomitan.backendReady', {});
+ this._sendMessageIgnoreResponse({action: 'Yomitan.backendReady', params: {}});
} catch (e) {
log.error(e);
throw e;
@@ -344,7 +344,7 @@ export class Backend {
}
_onZoomChange({tabId, oldZoomFactor, newZoomFactor}) {
- this._sendMessageTabIgnoreResponse(tabId, {action: 'Yomichan.zoomChanged', params: {oldZoomFactor, newZoomFactor}});
+ this._sendMessageTabIgnoreResponse(tabId, {action: 'Yomitan.zoomChanged', params: {oldZoomFactor, newZoomFactor}});
}
_onPermissionsChanged() {
@@ -360,7 +360,7 @@ export class Backend {
_onApiRequestBackendReadySignal(_params, sender) {
// tab ID isn't set in background (e.g. browser_action)
- const data = {action: 'Yomichan.backendReady', params: {}};
+ const data = {action: 'Yomitan.backendReady', params: {}};
if (typeof sender.tab === 'undefined') {
this._sendMessageIgnoreResponse(data);
return false;
@@ -997,7 +997,7 @@ export class Backend {
this._accessibilityController.update(this._getOptionsFull(false));
- this._sendMessageAllTabsIgnoreResponse('Yomichan.optionsUpdated', {source});
+ this._sendMessageAllTabsIgnoreResponse('Yomitan.optionsUpdated', {source});
}
_getOptionsFull(useSchema=false) {
@@ -1328,11 +1328,11 @@ export class Backend {
_validatePrivilegedMessageSender(sender) {
let {url} = sender;
- if (typeof url === 'string' && yomichan.isExtensionUrl(url)) { return; }
+ if (typeof url === 'string' && yomitan.isExtensionUrl(url)) { return; }
const {tab} = url;
if (typeof tab === 'object' && tab !== null) {
({url} = tab);
- if (typeof url === 'string' && yomichan.isExtensionUrl(url)) { return; }
+ if (typeof url === 'string' && yomitan.isExtensionUrl(url)) { return; }
}
throw new Error('Invalid message sender');
}
@@ -1432,7 +1432,7 @@ export class Backend {
try {
const {url} = await this._sendMessageTabPromise(
tabId,
- {action: 'Yomichan.getUrl', params: {}},
+ {action: 'Yomitan.getUrl', params: {}},
{frameId: 0}
);
if (typeof url === 'string') {
@@ -1568,7 +1568,7 @@ export class Backend {
sender.tab.id !== tabId ||
sender.frameId !== frameId ||
!isObject(message) ||
- message.action !== 'yomichanReady'
+ message.action !== 'yomitanReady'
) {
return;
}
@@ -1589,7 +1589,7 @@ export class Backend {
chrome.runtime.onMessage.addListener(onMessage);
- this._sendMessageTabPromise(tabId, {action: 'Yomichan.isReady'}, {frameId})
+ this._sendMessageTabPromise(tabId, {action: 'Yomitan.isReady'}, {frameId})
.then(
(value) => {
if (!value) { return; }
@@ -1826,7 +1826,7 @@ export class Backend {
let extension = MediaUtil.getFileExtensionFromAudioMediaType(contentType);
if (extension === null) { extension = '.mp3'; }
- let fileName = this._generateAnkiNoteMediaFileName('yomichan_audio', extension, timestamp, definitionDetails);
+ let fileName = this._generateAnkiNoteMediaFileName('yomitan_audio', extension, timestamp, definitionDetails);
fileName = fileName.replace(/\]/g, '');
fileName = await ankiConnect.storeMediaFile(fileName, data);
@@ -1843,7 +1843,7 @@ export class Backend {
throw new Error('Unknown media type for screenshot image');
}
- let fileName = this._generateAnkiNoteMediaFileName('yomichan_browser_screenshot', extension, timestamp, definitionDetails);
+ let fileName = this._generateAnkiNoteMediaFileName('yomitan_browser_screenshot', extension, timestamp, definitionDetails);
fileName = await ankiConnect.storeMediaFile(fileName, data);
return fileName;
@@ -1861,7 +1861,7 @@ export class Backend {
throw new Error('Unknown media type for clipboard image');
}
- let fileName = this._generateAnkiNoteMediaFileName('yomichan_clipboard_image', extension, timestamp, definitionDetails);
+ let fileName = this._generateAnkiNoteMediaFileName('yomitan_clipboard_image', extension, timestamp, definitionDetails);
fileName = await ankiConnect.storeMediaFile(fileName, data);
return fileName;
@@ -1897,7 +1897,7 @@ export class Backend {
if (media !== null) {
const {content, mediaType} = media;
const extension = MediaUtil.getFileExtensionFromImageMediaType(mediaType);
- fileName = this._generateAnkiNoteMediaFileName(`yomichan_dictionary_media_${i + 1}`, extension, timestamp, definitionDetails);
+ fileName = this._generateAnkiNoteMediaFileName(`yomitan_dictionary_media_${i + 1}`, extension, timestamp, definitionDetails);
try {
fileName = await ankiConnect.storeMediaFile(fileName, content);
} catch (e) {
@@ -2015,7 +2015,7 @@ export class Backend {
_triggerDatabaseUpdated(type, cause) {
this._translator.clearDatabaseCaches();
- this._sendMessageAllTabsIgnoreResponse('Yomichan.databaseUpdated', {type, cause});
+ this._sendMessageAllTabsIgnoreResponse('Yomitan.databaseUpdated', {type, cause});
}
async _saveOptions(source) {
diff --git a/ext/js/background/background-main.js b/ext/js/background/background-main.js
index 6c30aa7a..8e32a53f 100644
--- a/ext/js/background/background-main.js
+++ b/ext/js/background/background-main.js
@@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {Backend} from './backend.js';
(() => {
- yomichan.prepare(true);
+ yomitan.prepare(true);
const backend = new Backend();
backend.prepare();
diff --git a/ext/js/background/offscreen.js b/ext/js/background/offscreen.js
index c37cdedc..84ad6141 100644
--- a/ext/js/background/offscreen.js
+++ b/ext/js/background/offscreen.js
@@ -18,7 +18,7 @@
import {ClipboardReader} from '../comm/clipboard-reader.js';
import {invokeMessageHandler} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
/**
* This class controls the core logic of the extension, including API calls
@@ -63,11 +63,11 @@ export class Offscreen {
_validatePrivilegedMessageSender(sender) {
let {url} = sender;
- if (typeof url === 'string' && yomichan.isExtensionUrl(url)) { return; }
+ if (typeof url === 'string' && yomitan.isExtensionUrl(url)) { return; }
const {tab} = url;
if (typeof tab === 'object' && tab !== null) {
({url} = tab);
- if (typeof url === 'string' && yomichan.isExtensionUrl(url)) { return; }
+ if (typeof url === 'string' && yomitan.isExtensionUrl(url)) { return; }
}
throw new Error('Invalid message sender');
}