aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-14 18:04:19 -0400
committerGitHub <noreply@github.com>2021-03-14 18:04:19 -0400
commit52a4d874eada5be121e15d73d1d10e9a8d84bdb8 (patch)
tree0a8c2afe9ac507701b954c0510c3f38d14d999a0 /ext/js/background
parent06b02c3cf2ce725383f9a0bae87d3ef084ed8809 (diff)
Make MediaUtil a static class (#1525)
Diffstat (limited to 'ext/js/background')
-rw-r--r--ext/js/background/backend.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index f3568694..a2a93375 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -47,13 +47,11 @@ class Backend {
});
this._anki = new AnkiConnect();
this._mecab = new Mecab();
- this._mediaUtil = new MediaUtil();
this._clipboardReader = new ClipboardReader({
// eslint-disable-next-line no-undef
document: (typeof document === 'object' && document !== null ? document : null),
pasteTargetSelector: '#clipboard-paste-target',
- imagePasteTargetSelector: '#clipboard-image-paste-target',
- mediaUtil: this._mediaUtil
+ imagePasteTargetSelector: '#clipboard-image-paste-target'
});
this._clipboardMonitor = new ClipboardMonitor({
japaneseUtil: this._japaneseUtil,
@@ -1750,7 +1748,7 @@ class Backend {
return null;
}
- let extension = this._mediaUtil.getFileExtensionFromAudioMediaType(contentType);
+ let extension = MediaUtil.getFileExtensionFromAudioMediaType(contentType);
if (extension === null) { extension = '.mp3'; }
let fileName = this._generateAnkiNoteMediaFileName('yomichan_audio', extension, timestamp, definitionDetails);
fileName = fileName.replace(/\]/g, '');
@@ -1764,7 +1762,7 @@ class Backend {
const dataUrl = await this._getScreenshot(tabId, frameId, format, quality);
const {mediaType, data} = this._getDataUrlInfo(dataUrl);
- const extension = this._mediaUtil.getFileExtensionFromImageMediaType(mediaType);
+ const extension = MediaUtil.getFileExtensionFromImageMediaType(mediaType);
if (extension === null) {
throw new Error('Unknown media type for screenshot image');
}
@@ -1782,7 +1780,7 @@ class Backend {
}
const {mediaType, data} = this._getDataUrlInfo(dataUrl);
- const extension = this._mediaUtil.getFileExtensionFromImageMediaType(mediaType);
+ const extension = MediaUtil.getFileExtensionFromImageMediaType(mediaType);
if (extension === null) {
throw new Error('Unknown media type for clipboard image');
}