aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-12 11:19:43 +0900
committerGitHub <noreply@github.com>2023-11-12 11:19:43 +0900
commit47b4d79e646a990699a1a4ca1da559a4aeec1c91 (patch)
treec33f61ba85354f18c68d4a054baa30ff0c41c153 /ext/js/background
parent9162d950eb2b3aa0339d95a98a60be89b8315f26 (diff)
parentd06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (diff)
Merge branch 'master' into offscreen-db
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 2c007973..c29e5ee6 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';
@@ -238,7 +238,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();
@@ -269,8 +269,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;
@@ -357,7 +357,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() {
@@ -373,7 +373,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;
@@ -1010,7 +1010,7 @@ export class Backend {
this._accessibilityController.update(this._getOptionsFull(false));
- this._sendMessageAllTabsIgnoreResponse('Yomichan.optionsUpdated', {source});
+ this._sendMessageAllTabsIgnoreResponse('Yomitan.optionsUpdated', {source});
}
_getOptionsFull(useSchema=false) {
@@ -1341,11 +1341,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');
}
@@ -1445,7 +1445,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') {
@@ -1581,7 +1581,7 @@ export class Backend {
sender.tab.id !== tabId ||
sender.frameId !== frameId ||
!isObject(message) ||
- message.action !== 'yomichanReady'
+ message.action !== 'yomitanReady'
) {
return;
}
@@ -1602,7 +1602,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; }
@@ -1839,7 +1839,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);
@@ -1856,7 +1856,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;
@@ -1874,7 +1874,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;
@@ -1910,7 +1910,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) {
@@ -2028,7 +2028,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 1553d996..9e2139f7 100644
--- a/ext/js/background/offscreen.js
+++ b/ext/js/background/offscreen.js
@@ -23,7 +23,7 @@ import {ArrayBufferUtil} from '../data/sandbox/array-buffer-util.js';
import {DictionaryDatabase} from '../language/dictionary-database.js';
import {JapaneseUtil} from '../language/sandbox/japanese-util.js';
import {Translator} from '../language/translator.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
/**
* This class controls the core logic of the extension, including API calls
@@ -139,11 +139,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');
}