From 32dce68c6da75a3eb45aa0a205a49c5680e39355 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 23 May 2021 13:19:15 -0400 Subject: [PATCH] Fix incorrect selector causing invalid headword index to be used --- ext/js/display/display-audio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js index 4a1f630598..d855354712 100644 --- a/ext/js/display/display-audio.js +++ b/ext/js/display/display-audio.js @@ -283,7 +283,7 @@ class DisplayAudio { } _getAudioPlayButtonHeadwordIndex(button) { - const headwordNode = button.closest('.expression'); + const headwordNode = button.closest('.headword'); if (headwordNode !== null) { const headwordIndex = parseInt(headwordNode.dataset.index, 10); if (Number.isFinite(headwordIndex)) { return headwordIndex; } @@ -297,7 +297,7 @@ class DisplayAudio { if (dictionaryEntryIndex >= 0 && dictionaryEntryIndex < dictionaryEntryNodes.length) { const node = dictionaryEntryNodes[dictionaryEntryIndex]; const button1 = (headwordIndex === 0 ? node.querySelector('.action-play-audio') : null); - const button2 = node.querySelector(`.expression:nth-of-type(${headwordIndex + 1}) .action-play-audio`); + const button2 = node.querySelector(`.headword:nth-of-type(${headwordIndex + 1}) .action-play-audio`); if (button1 !== null) { results.push(button1); } if (button2 !== null) { results.push(button2); } }