aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-audio.js3
-rw-r--r--ext/js/display/display-generator.js3
-rw-r--r--ext/js/display/display-profile-selection.js5
-rw-r--r--ext/js/display/display.js31
-rw-r--r--ext/js/display/popup-main.js4
-rw-r--r--ext/js/display/query-parser.js5
-rw-r--r--ext/js/display/search-display-controller.js7
-rw-r--r--ext/js/display/search-main.js4
8 files changed, 26 insertions, 36 deletions
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index f624d85b..24f2dd7b 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -18,7 +18,6 @@
/* global
* AudioSystem
* PopupMenu
- * api
*/
class DisplayAudio {
@@ -314,7 +313,7 @@ class DisplayAudio {
}
async _getExpressionAudioInfoList(source, expression, reading, details) {
- const infoList = await api.getExpressionAudioInfoList(source, expression, reading, details);
+ const infoList = await yomichan.api.getExpressionAudioInfoList(source, expression, reading, details);
return infoList.map((info) => ({info, audioPromise: null, audioResolved: false, audio: null}));
}
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index 05376ee5..18159f68 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -18,7 +18,6 @@
/* global
* DictionaryDataUtil
* HtmlTemplateCollection
- * api
*/
class DisplayGenerator {
@@ -31,7 +30,7 @@ class DisplayGenerator {
}
async prepare() {
- const html = await api.getDisplayTemplatesHtml();
+ const html = await yomichan.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 0a44392e..d858da28 100644
--- a/ext/js/display/display-profile-selection.js
+++ b/ext/js/display/display-profile-selection.js
@@ -17,7 +17,6 @@
/* global
* PanelElement
- * api
*/
class DisplayProfileSelection {
@@ -67,7 +66,7 @@ class DisplayProfileSelection {
async _updateProfileList() {
this._profileListNeedsUpdate = false;
- const options = await api.optionsGetFull();
+ const options = await yomichan.api.optionsGetFull();
this._eventListeners.removeAllEventListeners();
const displayGenerator = this._display.displayGenerator;
@@ -95,7 +94,7 @@ class DisplayProfileSelection {
}
async _setProfileCurrent(index) {
- await api.modifySettings([{
+ await yomichan.api.modifySettings([{
action: 'set',
path: 'profileCurrent',
value: index,
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index fe4160a6..553c17e7 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -31,7 +31,6 @@
* QueryParser
* ScrollElement
* TextScanner
- * api
* dynamicLoader
*/
@@ -206,7 +205,7 @@ class Display extends EventDispatcher {
async prepare() {
// State setup
const {documentElement} = document;
- const {browser} = await api.getEnvironmentInfo();
+ const {browser} = await yomichan.api.getEnvironmentInfo();
this._browser = browser;
// Prepare
@@ -221,7 +220,7 @@ class Display extends EventDispatcher {
this._queryParser.on('searched', this._onQueryParserSearch.bind(this));
this._progressIndicatorVisible.on('change', this._onProgressIndicatorVisibleChanged.bind(this));
yomichan.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
- api.crossFrame.registerHandlers([
+ yomichan.crossFrame.registerHandlers([
['popupMessage', {async: 'dynamic', handler: this._onDirectMessage.bind(this)}]
]);
window.addEventListener('message', this._onWindowMessage.bind(this), false);
@@ -290,7 +289,7 @@ class Display extends EventDispatcher {
}
async updateOptions() {
- const options = await api.optionsGet(this.getOptionsContext());
+ const options = await yomichan.api.optionsGet(this.getOptionsContext());
const templates = await this._getAnkiFieldTemplates(options);
const {scanning: scanningOptions, sentenceParsing: sentenceParsingOptions} = options;
this._options = options;
@@ -674,7 +673,7 @@ class Display extends EventDispatcher {
if (typeof documentTitle !== 'string') { documentTitle = document.title; }
const optionsContext = this.getOptionsContext();
const query = e.currentTarget.textContent;
- const definitions = await api.kanjiFind(query, optionsContext);
+ const definitions = await yomichan.api.kanjiFind(query, optionsContext);
const details = {
focus: false,
history: true,
@@ -707,7 +706,7 @@ class Display extends EventDispatcher {
_onNoteView(e) {
e.preventDefault();
const link = e.currentTarget;
- api.noteView(link.dataset.noteId);
+ yomichan.api.noteView(link.dataset.noteId);
}
_onWheel(e) {
@@ -839,10 +838,10 @@ class Display extends EventDispatcher {
}
}
- const {definitions} = await api.termsFind(source, findDetails, optionsContext);
+ const {definitions} = await yomichan.api.termsFind(source, findDetails, optionsContext);
return definitions;
} else {
- const definitions = await api.kanjiFind(source, optionsContext);
+ const definitions = await yomichan.api.kanjiFind(source, optionsContext);
return definitions;
}
}
@@ -1059,7 +1058,7 @@ class Display extends EventDispatcher {
const noteContext = this._getNoteContext();
states = await this._areDefinitionsAddable(definitions, modes, noteContext);
} else {
- if (!await api.isAnkiConnected()) {
+ if (!await yomichan.api.isAnkiConnected()) {
throw new Error('Anki not connected');
}
states = this._areDefinitionsAddableForcedValue(definitions, modes, true);
@@ -1183,7 +1182,7 @@ class Display extends EventDispatcher {
_tryViewAnkiNoteForSelectedDefinition() {
const button = this._viewerButtonFind(this._index);
if (button !== null && !button.disabled) {
- api.noteView(button.dataset.noteId);
+ yomichan.api.noteView(button.dataset.noteId);
}
}
@@ -1206,7 +1205,7 @@ class Display extends EventDispatcher {
let noteId = null;
let addNoteOkay = false;
try {
- noteId = await api.addAnkiNote(note);
+ noteId = await yomichan.api.addAnkiNote(note);
addNoteOkay = true;
} catch (e) {
errors.length = 0;
@@ -1219,7 +1218,7 @@ class Display extends EventDispatcher {
} else {
if (suspendNewCards) {
try {
- await api.suspendAnkiCardsForNote(noteId);
+ await yomichan.api.suspendAnkiCardsForNote(noteId);
} catch (e) {
errors.push(e);
}
@@ -1400,7 +1399,7 @@ class Display extends EventDispatcher {
templates = this._ankiFieldTemplatesDefault;
if (typeof templates === 'string') { return templates; }
- templates = await api.getDefaultAnkiFieldTemplates();
+ templates = await yomichan.api.getDefaultAnkiFieldTemplates();
this._ankiFieldTemplatesDefault = templates;
return templates;
}
@@ -1416,7 +1415,7 @@ class Display extends EventDispatcher {
}
const notes = await Promise.all(notePromises);
- const infos = await api.getAnkiNoteInfo(notes);
+ const infos = await yomichan.api.getAnkiNoteInfo(notes);
const results = [];
for (let i = 0, ii = infos.length; i < ii; i += modeCount) {
results.push(infos.slice(i, i + modeCount));
@@ -1494,7 +1493,7 @@ class Display extends EventDispatcher {
image: this._ankiNoteBuilder.containsMarker(fields, 'clipboard-image'),
text: this._ankiNoteBuilder.containsMarker(fields, 'clipboard-text')
};
- return await api.injectAnkiNoteMedia(
+ return await yomichan.api.injectAnkiNoteMedia(
timestamp,
definitionDetails,
audioDetails,
@@ -1605,7 +1604,7 @@ class Display extends EventDispatcher {
if (this._contentOriginTabId === this._tabId && this._contentOriginFrameId === this._frameId) {
throw new Error('Content origin is same page');
}
- return await api.crossFrame.invokeTab(this._contentOriginTabId, this._contentOriginFrameId, action, params);
+ return await yomichan.crossFrame.invokeTab(this._contentOriginTabId, this._contentOriginFrameId, action, params);
}
_copyHostSelection() {
diff --git a/ext/js/display/popup-main.js b/ext/js/display/popup-main.js
index f1228aa6..24be6c01 100644
--- a/ext/js/display/popup-main.js
+++ b/ext/js/display/popup-main.js
@@ -21,7 +21,6 @@
* DocumentFocusController
* HotkeyHandler
* JapaneseUtil
- * api
*/
(async () => {
@@ -29,10 +28,9 @@
const documentFocusController = new DocumentFocusController();
documentFocusController.prepare();
- api.prepare();
await yomichan.prepare();
- const {tabId, frameId} = await api.frameInformationGet();
+ const {tabId, frameId} = await yomichan.api.frameInformationGet();
const japaneseUtil = new JapaneseUtil(null);
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index 05ebfa27..29401657 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -17,7 +17,6 @@
/* global
* TextScanner
- * api
*/
class QueryParser extends EventDispatcher {
@@ -76,7 +75,7 @@ class QueryParser extends EventDispatcher {
const token = {};
this._setTextToken = token;
- this._parseResults = await api.textParse(text, this._getOptionsContext());
+ this._parseResults = await yomichan.api.textParse(text, this._getOptionsContext());
if (this._setTextToken !== token) { return; }
this._refreshSelectedParser();
@@ -116,7 +115,7 @@ class QueryParser extends EventDispatcher {
_setSelectedParser(value) {
const optionsContext = this._getOptionsContext();
- api.modifySettings([{
+ yomichan.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 a295346d..3b48af44 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -17,7 +17,6 @@
/* global
* ClipboardMonitor
- * api
* wanakana
*/
@@ -40,7 +39,7 @@ class SearchDisplayController {
this._clipboardMonitor = new ClipboardMonitor({
japaneseUtil,
clipboardReader: {
- getText: async () => (await api.clipboardGet())
+ getText: async () => (await yomichan.api.clipboardGet())
}
});
this._messageHandlers = new Map();
@@ -201,7 +200,7 @@ class SearchDisplayController {
_onWanakanaEnableChange(e) {
const value = e.target.checked;
this._setWanakanaEnabled(value);
- api.modifySettings([{
+ yomichan.api.modifySettings([{
action: 'set',
path: 'general.enableWanakana',
value,
@@ -301,7 +300,7 @@ class SearchDisplayController {
if (!modify) { return; }
- await api.modifySettings([{
+ await yomichan.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 d3e8af0b..08645833 100644
--- a/ext/js/display/search-main.js
+++ b/ext/js/display/search-main.js
@@ -21,7 +21,6 @@
* HotkeyHandler
* JapaneseUtil
* SearchDisplayController
- * api
* wanakana
*/
@@ -30,10 +29,9 @@
const documentFocusController = new DocumentFocusController();
documentFocusController.prepare();
- api.prepare();
await yomichan.prepare();
- const {tabId, frameId} = await api.frameInformationGet();
+ const {tabId, frameId} = await yomichan.api.frameInformationGet();
const japaneseUtil = new JapaneseUtil(wanakana);