summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-07 07:02:50 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-07 07:02:50 +0300
commit94d590fc85f87028d8264e93c8ad58c71d0977f2 (patch)
treea4f1bd946674995fed7748b5433dba5fe37a2f93 /ext/mixed/js
parent981d9eddb69322494589c241d049652c9091ed06 (diff)
merged mode: support audio and tags for terms
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js10
1 files changed, 6 insertions, 4 deletions
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';
}