diff options
author | Alex Yatskov <alex@foosoft.net> | 2018-03-12 13:04:37 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2018-03-12 13:04:37 -0700 |
commit | 68cdd7d85b741d34133ea04b95a4eb1e49553ace (patch) | |
tree | b6041ae3bbd2c327e57ca0766d77f3e11c654066 /ext/mixed | |
parent | f0e9716aa5e763480cf6accceefcea4fa73bc149 (diff) | |
parent | 2470b6209a27ceea814a13d920a20683bacf09a6 (diff) |
Merge branch 'dev'
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/js/display.js | 15 |
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() |