aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2017-10-26 09:58:32 -0700
committerGitHub <noreply@github.com>2017-10-26 09:58:32 -0700
commit25ae2e475ab15cbc241818812137c9cf28c2da3a (patch)
treea619a61d068d75850e1cecec63eda391109317e2 /ext/mixed/js
parent05648b9995955e057af0217f3eaa778a252c5bd7 (diff)
parentab1e2b3d5d79d177d273bb19841615d43cd83df6 (diff)
Merge pull request #95 from siikamiika/feature-merge-similar-results
Feature: result grouping by main dictionary sequence (along with some other changes)
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 302a6280..41fe85eb 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 = link.closest('.entry').find('.expression .action-play-audio').index(link);
+ this.audioPlay(this.definitions[definitionIndex], expressionIndex);
}
onNoteAdd(e) {
@@ -183,7 +185,7 @@ class Display {
80: /* p */ () => {
if (e.altKey) {
if ($('.entry').eq(this.index).data('type') === 'term') {
- this.audioPlay(this.definitions[this.index]);
+ this.audioPlay(this.definitions[this.index], this.options.general.resultOutputMode === 'merge' ? 0 : -1);
}
return true;
@@ -234,8 +236,10 @@ class Display {
const params = {
definitions,
addable: options.anki.enable,
- grouped: options.general.groupResults,
+ grouped: options.general.resultOutputMode === 'group',
+ merged: options.general.resultOutputMode === 'merge',
playback: options.general.audioSource !== 'disabled',
+ compactGlossaries: options.general.compactGlossaries,
debug: options.general.debugInfo
};
@@ -379,11 +383,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';
}