summaryrefslogtreecommitdiff
path: root/ext/mixed/js/display.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r--ext/mixed/js/display.js30
1 files changed, 11 insertions, 19 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 2e59b4ff..380134ad 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -22,15 +22,7 @@
* DisplayGenerator
* MediaLoader
* WindowScroll
- * apiAudioGetUri
- * apiBroadcastTab
- * apiDefinitionAdd
- * apiDefinitionsAddable
- * apiKanjiFind
- * apiNoteView
- * apiOptionsGet
- * apiScreenshotGet
- * apiTermsFind
+ * api
* docRangeFromPoint
* docSentenceExtract
*/
@@ -49,7 +41,7 @@ class Display {
this.audioSystem = new AudioSystem({
audioUriBuilder: {
getUri: async (definition, source, details) => {
- return await apiAudioGetUri(definition, source, details);
+ return await api.audioGetUri(definition, source, details);
}
},
useCache: true
@@ -212,7 +204,7 @@ class Display {
url: this.context.get('url')
};
- const definitions = await apiKanjiFind(link.textContent, this.getOptionsContext());
+ const definitions = await api.kanjiFind(link.textContent, this.getOptionsContext());
this.setContent('kanji', {definitions, context});
} catch (error) {
this.onError(error);
@@ -290,7 +282,7 @@ class Display {
try {
textSource.setEndOffset(this.options.scanning.length);
- ({definitions, length} = await apiTermsFind(textSource.text(), {}, this.getOptionsContext()));
+ ({definitions, length} = await api.termsFind(textSource.text(), {}, this.getOptionsContext()));
if (definitions.length === 0) {
return false;
}
@@ -334,7 +326,7 @@ class Display {
onNoteView(e) {
e.preventDefault();
const link = e.currentTarget;
- apiNoteView(link.dataset.noteId);
+ api.noteView(link.dataset.noteId);
}
onKeyDown(e) {
@@ -379,7 +371,7 @@ class Display {
}
async updateOptions() {
- this.options = await apiOptionsGet(this.getOptionsContext());
+ this.options = await api.optionsGet(this.getOptionsContext());
this.updateDocumentOptions(this.options);
this.updateTheme(this.options.general.popupTheme);
this.setCustomCss(this.options.general.customPopupCss);
@@ -746,7 +738,7 @@ class Display {
noteTryView() {
const button = this.viewerButtonFind(this.index);
if (button !== null && !button.classList.contains('disabled')) {
- apiNoteView(button.dataset.noteId);
+ api.noteView(button.dataset.noteId);
}
}
@@ -763,7 +755,7 @@ class Display {
}
const context = await this._getNoteContext();
- const noteId = await apiDefinitionAdd(definition, mode, context, details, this.getOptionsContext());
+ const noteId = await api.definitionAdd(definition, mode, context, details, this.getOptionsContext());
if (noteId) {
const index = this.definitions.indexOf(definition);
const adderButton = this.adderButtonFind(index, mode);
@@ -857,7 +849,7 @@ class Display {
await promiseTimeout(1); // Wait for popup to be hidden.
const {format, quality} = this.options.anki.screenshot;
- const dataUrl = await apiScreenshotGet({format, quality});
+ const dataUrl = await api.screenshotGet({format, quality});
if (!dataUrl || dataUrl.error) { return; }
return {dataUrl, format};
@@ -871,7 +863,7 @@ class Display {
}
setPopupVisibleOverride(visible) {
- return apiBroadcastTab('popupSetVisibleOverride', {visible});
+ return api.broadcastTab('popupSetVisibleOverride', {visible});
}
setSpinnerVisible(visible) {
@@ -933,7 +925,7 @@ class Display {
async getDefinitionsAddable(definitions, modes) {
try {
const context = await this._getNoteContext();
- return await apiDefinitionsAddable(definitions, modes, context, this.getOptionsContext());
+ return await api.definitionsAddable(definitions, modes, context, this.getOptionsContext());
} catch (e) {
return [];
}