From 94d590fc85f87028d8264e93c8ad58c71d0977f2 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sat, 7 Oct 2017 07:02:50 +0300 Subject: merged mode: support audio and tags for terms --- ext/mixed/js/display.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ext/mixed/js') diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 2dd95692..e54c8b18 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -71,8 +71,10 @@ class Display { onAudioPlay(e) { e.preventDefault(); - const index = Display.entryIndexFind($(e.currentTarget)); - this.audioPlay(this.definitions[index]); + const link = $(e.currentTarget); + const definitionIndex = Display.entryIndexFind(link); + const expressionIndex = $(e.currentTarget).closest('.entry').find('.expression .action-play-audio').index(link); + this.audioPlay(this.definitions[definitionIndex], expressionIndex); } onNoteAdd(e) { @@ -380,11 +382,11 @@ class Display { } } - async audioPlay(definition) { + async audioPlay(definition, expressionIndex) { try { this.spinner.show(); - let url = await apiAudioGetUrl(definition, this.options.general.audioSource); + let url = await apiAudioGetUrl(expressionIndex === -1 ? definition : definition.expressions[expressionIndex], this.options.general.audioSource); if (!url) { url = '/mixed/mp3/button.mp3'; } -- cgit v1.2.3