Commit 247ec8ae authored by i❤computers's avatar i❤computers
Browse files

Don't play audio when clicking on flag's blue stripes

parent 5d226004
......@@ -6,7 +6,9 @@ document.addEventListener('DOMContentLoaded', function initializePage() {
// Ideally these transitions are applied directly to html
var MAX_TRANSITION_TIME = 0.4; //make sure transition time matches in index.html's styling
cuesTrack
.filter(function isTextHighlight(cue) { return cue.isTextHighlight; })
.filter(function isTextHighlight(cue) {
return cue.isTextHighlight;
})
.forEach(function setShortTransitionTimes(cue, index, cuesTrack) {
if (index + 1 === cuesTrack.length) {
return;
......@@ -26,11 +28,23 @@ document.addEventListener('DOMContentLoaded', function initializePage() {
$('article').on('click', function playFromCue(event) {
var target = event.target;
var cuePositionName = target.dataset.cuePosition;
if (cuePositionName) {
playAudio(cuesTrack.filter(function (cueTrack) {
return cueTrack.cuePositionName.localeCompare(cuePositionName) === 0;
})[0].startTime);
if (!cuePositionName) {
return;
}
const matchingCue = cuesTrack.find(cueTrack =>
cueTrack.cuePositionName.localeCompare(cuePositionName) === 0
&& cueTrack.isTextHighlight);
if (!matchingCue) {
return;
}
const startTime = matchingCue.startTime;
if (!Number.isFinite(startTime)) {
return;
}
playAudio(startTime);
});
audio.on('ended', resetPlayer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment