aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/background.html1
-rw-r--r--ext/bg/js/audio.js12
-rw-r--r--ext/bg/search.html2
3 files changed, 9 insertions, 6 deletions
diff --git a/ext/bg/background.html b/ext/bg/background.html
index 3b37db87..194d4a45 100644
--- a/ext/bg/background.html
+++ b/ext/bg/background.html
@@ -27,6 +27,7 @@
<script src="/bg/js/templates.js"></script>
<script src="/bg/js/translator.js"></script>
<script src="/bg/js/util.js"></script>
+ <script src="/mixed/js/audio.js"></script>
<script src="/mixed/js/japanese.js"></script>
<script src="/bg/js/backend.js"></script>
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 26896027..0bf836df 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -136,6 +136,7 @@ function audioBuildFilename(definition) {
return filename += '.mp3';
}
+ return null;
}
async function audioInject(definition, fields, sources, optionsContext) {
@@ -157,11 +158,12 @@ async function audioInject(definition, fields, sources, optionsContext) {
audioSourceDefinition = definition.expressions[0];
}
- const url = await audioBuildUrl(audioSourceDefinition, sources[0], optionsContext);
- const filename = audioBuildFilename(audioSourceDefinition);
-
- if (url && filename) {
- definition.audio = {url, filename};
+ const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, false);
+ if (url !== null) {
+ const filename = audioBuildFilename(audioSourceDefinition);
+ if (filename !== null) {
+ definition.audio = {url, filename};
+ }
}
return true;
diff --git a/ext/bg/search.html b/ext/bg/search.html
index e71824d3..3284ed43 100644
--- a/ext/bg/search.html
+++ b/ext/bg/search.html
@@ -36,7 +36,6 @@
<script src="/mixed/js/extension.js"></script>
- <script src="/bg/js/audio.js"></script>
<script src="/bg/js/dictionary.js"></script>
<script src="/bg/js/handlebars.js"></script>
<script src="/bg/js/templates.js"></script>
@@ -44,6 +43,7 @@
<script src="/fg/js/document.js"></script>
<script src="/fg/js/source.js"></script>
<script src="/fg/js/util.js"></script>
+ <script src="/mixed/js/audio.js"></script>
<script src="/mixed/js/display.js"></script>
<script src="/mixed/js/japanese.js"></script>
<script src="/mixed/js/scroll.js"></script>