summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 5d3c4f2e..43eb93c1 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -185,8 +185,7 @@ class Display {
80: /* p */ () => {
if (e.altKey) {
if ($('.entry').eq(this.index).data('type') === 'term') {
- const expressionIndex = this.options.general.resultOutputMode === 'merge' ? 0 : -1;
- this.audioPlay(this.definitions[this.index], expressionIndex);
+ this.audioPlay(this.definitions[this.index], this.firstExpressionIndex);
}
return true;
@@ -258,6 +257,10 @@ class Display {
this.container.html(content);
this.entryScrollIntoView(context && context.index || 0);
+ if (this.options.general.autoPlayAudio && this.options.general.audioSource !== 'disabled') {
+ this.autoPlayAudio();
+ }
+
$('.action-add-note').click(this.onNoteAdd.bind(this));
$('.action-view-note').click(this.onNoteView.bind(this));
$('.action-play-audio').click(this.onAudioPlay.bind(this));
@@ -309,6 +312,10 @@ class Display {
}
}
+ autoPlayAudio() {
+ this.audioPlay(this.definitions[0], this.firstExpressionIndex);
+ }
+
async adderButtonUpdate(modes, sequence) {
try {
const states = await apiDefinitionsAddable(this.definitions, modes);
@@ -422,6 +429,10 @@ class Display {
}
}
+ get firstExpressionIndex() {
+ return this.options.general.resultOutputMode === 'merge' ? 0 : -1;
+ }
+
static clozeBuild(sentence, source) {
const result = {
sentence: sentence.text.trim()