summaryrefslogtreecommitdiff
path: root/ext/js/display
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/display
parent9162d950eb2b3aa0339d95a98a60be89b8315f26 (diff)
parentd06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (diff)
Merge branch 'master' into offscreen-db
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-anki.js14
-rw-r--r--ext/js/display/display-audio.js4
-rw-r--r--ext/js/display/display-content-manager.js4
-rw-r--r--ext/js/display/display-generator.js4
-rw-r--r--ext/js/display/display-profile-selection.js8
-rw-r--r--ext/js/display/display.js30
-rw-r--r--ext/js/display/option-toggle-hotkey-handler.js6
-rw-r--r--ext/js/display/popup-main.js8
-rw-r--r--ext/js/display/query-parser.js6
-rw-r--r--ext/js/display/search-display-controller.js10
-rw-r--r--ext/js/display/search-main.js8
11 files changed, 51 insertions, 51 deletions
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index a25008a2..2f94e414 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -20,7 +20,7 @@ import {EventListenerCollection, deferPromise, isObject} from '../core.js';
import {AnkiNoteBuilder} from '../data/anki-note-builder.js';
import {AnkiUtil} from '../data/anki-util.js';
import {PopupMenu} from '../dom/popup-menu.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class DisplayAnki {
constructor(display, displayAudio, japaneseUtil) {
@@ -377,7 +377,7 @@ export class DisplayAnki {
let noteId = null;
let addNoteOkay = false;
try {
- noteId = await yomichan.api.addAnkiNote(note);
+ noteId = await yomitan.api.addAnkiNote(note);
addNoteOkay = true;
} catch (e) {
allErrors.length = 0;
@@ -390,7 +390,7 @@ export class DisplayAnki {
} else {
if (this._suspendNewCards) {
try {
- await yomichan.api.suspendAnkiCardsForNote(noteId);
+ await yomitan.api.suspendAnkiCardsForNote(noteId);
} catch (e) {
allErrors.push(e);
}
@@ -475,7 +475,7 @@ export class DisplayAnki {
templates = this._ankiFieldTemplatesDefault;
if (typeof templates === 'string') { return templates; }
- templates = await yomichan.api.getDefaultAnkiFieldTemplates();
+ templates = await yomitan.api.getDefaultAnkiFieldTemplates();
this._ankiFieldTemplatesDefault = templates;
return templates;
}
@@ -505,12 +505,12 @@ export class DisplayAnki {
let ankiError = null;
try {
if (forceCanAddValue !== null) {
- if (!await yomichan.api.isAnkiConnected()) {
+ if (!await yomitan.api.isAnkiConnected()) {
throw new Error('Anki not connected');
}
infos = this._getAnkiNoteInfoForceValue(notes, forceCanAddValue);
} else {
- infos = await yomichan.api.getAnkiNoteInfo(notes, fetchAdditionalInfo);
+ infos = await yomitan.api.getAnkiNoteInfo(notes, fetchAdditionalInfo);
}
} catch (e) {
infos = this._getAnkiNoteInfoForceValue(notes, false);
@@ -663,7 +663,7 @@ export class DisplayAnki {
const noteIds = this._getNodeNoteIds(node);
if (noteIds.length === 0) { return; }
try {
- await yomichan.api.noteView(noteIds[0], this._noteGuiMode, false);
+ await yomitan.api.noteView(noteIds[0], this._noteGuiMode, false);
} catch (e) {
const displayErrors = (
e.message === 'Mode not supported' ?
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index b829dd1a..faed88bc 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -19,7 +19,7 @@
import {EventListenerCollection} from '../core.js';
import {PopupMenu} from '../dom/popup-menu.js';
import {AudioSystem} from '../media/audio-system.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class DisplayAudio {
constructor(display) {
@@ -531,7 +531,7 @@ export class DisplayAudio {
async _getTermAudioInfoList(source, term, reading) {
const sourceData = this._getSourceData(source);
- const infoList = await yomichan.api.getTermAudioInfoList(sourceData, term, reading);
+ const infoList = await yomitan.api.getTermAudioInfoList(sourceData, term, reading);
return infoList.map((info) => ({info, audioPromise: null, audioResolved: false, audio: null}));
}
diff --git a/ext/js/display/display-content-manager.js b/ext/js/display/display-content-manager.js
index 6cba1783..fb2e7db5 100644
--- a/ext/js/display/display-content-manager.js
+++ b/ext/js/display/display-content-manager.js
@@ -18,7 +18,7 @@
import {EventListenerCollection} from '../core.js';
import {ArrayBufferUtil} from '../data/sandbox/array-buffer-util.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
/**
* A callback used when a media file has been loaded.
@@ -138,7 +138,7 @@ export class DisplayContentManager {
async _getMediaData(path, dictionary, cachedData) {
const token = this._token;
- const data = (await yomichan.api.getMedia([{path, dictionary}]))[0];
+ const data = (await yomitan.api.getMedia([{path, dictionary}]))[0];
if (token === this._token && data !== null) {
const buffer = ArrayBufferUtil.base64ToArrayBuffer(data.content);
const blob = new Blob([buffer], {type: data.mediaType});
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index 25df9745..e8a2104f 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -19,7 +19,7 @@
import {isObject} from '../core.js';
import {HtmlTemplateCollection} from '../dom/html-template-collection.js';
import {DictionaryDataUtil} from '../language/sandbox/dictionary-data-util.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {PronunciationGenerator} from './sandbox/pronunciation-generator.js';
import {StructuredContentGenerator} from './sandbox/structured-content-generator.js';
@@ -34,7 +34,7 @@ export class DisplayGenerator {
}
async prepare() {
- const html = await yomichan.api.getDisplayTemplatesHtml();
+ const html = await yomitan.api.getDisplayTemplatesHtml();
this._templates = new HtmlTemplateCollection(html);
this.updateHotkeys();
}
diff --git a/ext/js/display/display-profile-selection.js b/ext/js/display/display-profile-selection.js
index c0b642e8..d8b7185c 100644
--- a/ext/js/display/display-profile-selection.js
+++ b/ext/js/display/display-profile-selection.js
@@ -18,7 +18,7 @@
import {EventListenerCollection, generateId} from '../core.js';
import {PanelElement} from '../dom/panel-element.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class DisplayProfileSelection {
constructor(display) {
@@ -35,7 +35,7 @@ export class DisplayProfileSelection {
}
async prepare() {
- yomichan.on('optionsUpdated', this._onOptionsUpdated.bind(this));
+ yomitan.on('optionsUpdated', this._onOptionsUpdated.bind(this));
this._profileButton.addEventListener('click', this._onProfileButtonClick.bind(this), false);
this._profileListNeedsUpdate = true;
}
@@ -67,7 +67,7 @@ export class DisplayProfileSelection {
async _updateProfileList() {
this._profileListNeedsUpdate = false;
- const options = await yomichan.api.optionsGetFull();
+ const options = await yomitan.api.optionsGetFull();
this._eventListeners.removeAllEventListeners();
const displayGenerator = this._display.displayGenerator;
@@ -95,7 +95,7 @@ export class DisplayProfileSelection {
}
async _setProfileCurrent(index) {
- await yomichan.api.modifySettings([{
+ await yomitan.api.modifySettings([{
action: 'set',
path: 'profileCurrent',
value: index,
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index b86b877d..038a76bb 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -26,7 +26,7 @@ import {ScrollElement} from '../dom/scroll-element.js';
import {HotkeyHelpController} from '../input/hotkey-help-controller.js';
import {TextScanner} from '../language/text-scanner.js';
import {dynamicLoader} from '../script/dynamic-loader.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {DisplayContentManager} from './display-content-manager.js';
import {DisplayGenerator} from './display-generator.js';
import {DisplayHistory} from './display-history.js';
@@ -260,7 +260,7 @@ export class Display extends EventDispatcher {
// State setup
const {documentElement} = document;
- const {browser} = await yomichan.api.getEnvironmentInfo();
+ const {browser} = await yomitan.api.getEnvironmentInfo();
this._browser = browser;
if (documentElement !== null) {
@@ -278,8 +278,8 @@ export class Display extends EventDispatcher {
this._history.on('stateChanged', this._onStateChanged.bind(this));
this._queryParser.on('searched', this._onQueryParserSearch.bind(this));
this._progressIndicatorVisible.on('change', this._onProgressIndicatorVisibleChanged.bind(this));
- yomichan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
- yomichan.crossFrame.registerHandlers([
+ yomitan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
+ yomitan.crossFrame.registerHandlers([
['popupMessage', {async: 'dynamic', handler: this._onDirectMessage.bind(this)}]
]);
window.addEventListener('message', this._onWindowMessage.bind(this), false);
@@ -326,7 +326,7 @@ export class Display extends EventDispatcher {
}
onError(error) {
- if (yomichan.isExtensionUnloaded) { return; }
+ if (yomitan.isExtensionUnloaded) { return; }
log.error(error);
}
@@ -344,7 +344,7 @@ export class Display extends EventDispatcher {
}
async updateOptions() {
- const options = await yomichan.api.optionsGet(this.getOptionsContext());
+ const options = await yomitan.api.optionsGet(this.getOptionsContext());
const {scanning: scanningOptions, sentenceParsing: sentenceParsingOptions} = options;
this._options = options;
@@ -494,14 +494,14 @@ export class Display extends EventDispatcher {
if (this._contentOriginTabId === this._tabId && this._contentOriginFrameId === this._frameId) {
throw new Error('Content origin is same page');
}
- return await yomichan.crossFrame.invokeTab(this._contentOriginTabId, this._contentOriginFrameId, action, params);
+ return await yomitan.crossFrame.invokeTab(this._contentOriginTabId, this._contentOriginFrameId, action, params);
}
async invokeParentFrame(action, params={}) {
if (this._parentFrameId === null || this._parentFrameId === this._frameId) {
throw new Error('Invalid parent frame');
}
- return await yomichan.crossFrame.invoke(this._parentFrameId, action, params);
+ return await yomitan.crossFrame.invoke(this._parentFrameId, action, params);
}
getElementDictionaryEntryIndex(element) {
@@ -586,8 +586,8 @@ export class Display extends EventDispatcher {
}
_onMessageExtensionUnloaded() {
- if (yomichan.isExtensionUnloaded) { return; }
- yomichan.triggerExtensionUnloaded();
+ if (yomitan.isExtensionUnloaded) { return; }
+ yomitan.triggerExtensionUnloaded();
}
// Private
@@ -736,7 +736,7 @@ export class Display extends EventDispatcher {
if (typeof documentTitle !== 'string') { documentTitle = document.title; }
const optionsContext = this.getOptionsContext();
const query = e.currentTarget.textContent;
- const dictionaryEntries = await yomichan.api.kanjiFind(query, optionsContext);
+ const dictionaryEntries = await yomitan.api.kanjiFind(query, optionsContext);
const details = {
focus: false,
historyMode: 'new',
@@ -914,7 +914,7 @@ export class Display extends EventDispatcher {
async _findDictionaryEntries(isKanji, source, wildcardsEnabled, optionsContext) {
if (isKanji) {
- const dictionaryEntries = await yomichan.api.kanjiFind(source, optionsContext);
+ const dictionaryEntries = await yomitan.api.kanjiFind(source, optionsContext);
return dictionaryEntries;
} else {
const findDetails = {};
@@ -932,7 +932,7 @@ export class Display extends EventDispatcher {
}
}
- const {dictionaryEntries} = await yomichan.api.termsFind(source, findDetails, optionsContext);
+ const {dictionaryEntries} = await yomitan.api.termsFind(source, findDetails, optionsContext);
return dictionaryEntries;
}
}
@@ -1334,7 +1334,7 @@ export class Display extends EventDispatcher {
}
_closePopups() {
- yomichan.trigger('closePopups');
+ yomitan.trigger('closePopups');
}
async _setOptionsContextIfDifferent(optionsContext) {
@@ -1549,7 +1549,7 @@ export class Display extends EventDispatcher {
}
_onContentTextScannerSearched({type, dictionaryEntries, sentence, textSource, optionsContext, error}) {
- if (error !== null && !yomichan.isExtensionUnloaded) {
+ if (error !== null && !yomitan.isExtensionUnloaded) {
log.error(error);
}
diff --git a/ext/js/display/option-toggle-hotkey-handler.js b/ext/js/display/option-toggle-hotkey-handler.js
index 360b0894..1f8de939 100644
--- a/ext/js/display/option-toggle-hotkey-handler.js
+++ b/ext/js/display/option-toggle-hotkey-handler.js
@@ -17,7 +17,7 @@
*/
import {deserializeError} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class OptionToggleHotkeyHandler {
constructor(display) {
@@ -52,7 +52,7 @@ export class OptionToggleHotkeyHandler {
try {
const optionsContext = this._display.getOptionsContext();
- const result = (await yomichan.api.getSettings([{
+ const result = (await yomitan.api.getSettings([{
scope: 'profile',
path,
optionsContext
@@ -69,7 +69,7 @@ export class OptionToggleHotkeyHandler {
value = !value;
- const result2 = (await yomichan.api.modifySettings([{
+ const result2 = (await yomitan.api.modifySettings([{
scope: 'profile',
action: 'set',
path,
diff --git a/ext/js/display/popup-main.js b/ext/js/display/popup-main.js
index b82458fa..6b07b63f 100644
--- a/ext/js/display/popup-main.js
+++ b/ext/js/display/popup-main.js
@@ -20,7 +20,7 @@ import {log} from '../core.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
import {JapaneseUtil} from '../language/sandbox/japanese-util.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {DisplayAnki} from './display-anki.js';
import {DisplayAudio} from './display-audio.js';
import {DisplayProfileSelection} from './display-profile-selection.js';
@@ -32,9 +32,9 @@ import {Display} from './display.js';
const documentFocusController = new DocumentFocusController();
documentFocusController.prepare();
- await yomichan.prepare();
+ await yomitan.prepare();
- const {tabId, frameId} = await yomichan.api.frameInformationGet();
+ const {tabId, frameId} = await yomitan.api.frameInformationGet();
const japaneseUtil = new JapaneseUtil(null);
@@ -60,7 +60,7 @@ import {Display} from './display.js';
document.documentElement.dataset.loaded = 'true';
- yomichan.ready();
+ yomitan.ready();
} catch (e) {
log.error(e);
}
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index 6eee55b2..85ec3031 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -18,7 +18,7 @@
import {EventDispatcher, log} from '../core.js';
import {TextScanner} from '../language/text-scanner.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class QueryParser extends EventDispatcher {
constructor({getSearchContext, japaneseUtil}) {
@@ -93,7 +93,7 @@ export class QueryParser extends EventDispatcher {
const token = {};
this._setTextToken = token;
- this._parseResults = await yomichan.api.parseText(text, this._getOptionsContext(), this._scanLength, this._useInternalParser, this._useMecabParser);
+ this._parseResults = await yomitan.api.parseText(text, this._getOptionsContext(), this._scanLength, this._useInternalParser, this._useMecabParser);
if (this._setTextToken !== token) { return; }
this._refreshSelectedParser();
@@ -139,7 +139,7 @@ export class QueryParser extends EventDispatcher {
_setSelectedParser(value) {
const optionsContext = this._getOptionsContext();
- yomichan.api.modifySettings([{
+ yomitan.api.modifySettings([{
action: 'set',
path: 'parsing.selectedParser',
value,
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index 9e190c85..e31bd239 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -19,7 +19,7 @@
import * as wanakana from '../../lib/wanakana.js';
import {ClipboardMonitor} from '../comm/clipboard-monitor.js';
import {EventListenerCollection, invokeMessageHandler} from '../core.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export class SearchDisplayController {
constructor(tabId, frameId, display, displayAudio, japaneseUtil, searchPersistentStateController) {
@@ -44,7 +44,7 @@ export class SearchDisplayController {
this._clipboardMonitor = new ClipboardMonitor({
japaneseUtil,
clipboardReader: {
- getText: yomichan.api.clipboardGet.bind(yomichan.api)
+ getText: yomitan.api.clipboardGet.bind(yomitan.api)
}
});
this._messageHandlers = new Map();
@@ -56,7 +56,7 @@ export class SearchDisplayController {
this._searchPersistentStateController.on('modeChange', this._onModeChange.bind(this));
chrome.runtime.onMessage.addListener(this._onMessage.bind(this));
- yomichan.on('optionsUpdated', this._onOptionsUpdated.bind(this));
+ yomitan.on('optionsUpdated', this._onOptionsUpdated.bind(this));
this._display.on('optionsUpdated', this._onDisplayOptionsUpdated.bind(this));
this._display.on('contentUpdateStart', this._onContentUpdateStart.bind(this));
@@ -225,7 +225,7 @@ export class SearchDisplayController {
_onWanakanaEnableChange(e) {
const value = e.target.checked;
this._setWanakanaEnabled(value);
- yomichan.api.modifySettings([{
+ yomitan.api.modifySettings([{
action: 'set',
path: 'general.enableWanakana',
value,
@@ -335,7 +335,7 @@ export class SearchDisplayController {
if (!modify) { return; }
- await yomichan.api.modifySettings([{
+ await yomitan.api.modifySettings([{
action: 'set',
path: 'clipboard.enableSearchPageMonitor',
value,
diff --git a/ext/js/display/search-main.js b/ext/js/display/search-main.js
index 67552229..5eee08d1 100644
--- a/ext/js/display/search-main.js
+++ b/ext/js/display/search-main.js
@@ -21,7 +21,7 @@ import {log} from '../core.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
import {JapaneseUtil} from '../language/sandbox/japanese-util.js';
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
import {DisplayAnki} from './display-anki.js';
import {DisplayAudio} from './display-audio.js';
import {Display} from './display.js';
@@ -40,9 +40,9 @@ import {SearchPersistentStateController} from './search-persistent-state-control
const searchActionPopupController = new SearchActionPopupController(searchPersistentStateController);
searchActionPopupController.prepare();
- await yomichan.prepare();
+ await yomitan.prepare();
- const {tabId, frameId} = await yomichan.api.frameInformationGet();
+ const {tabId, frameId} = await yomitan.api.frameInformationGet();
const japaneseUtil = new JapaneseUtil(wanakana);
@@ -65,7 +65,7 @@ import {SearchPersistentStateController} from './search-persistent-state-control
document.documentElement.dataset.loaded = 'true';
- yomichan.ready();
+ yomitan.ready();
} catch (e) {
log.error(e);
}