From 76bd2482a4d8ca5ff192915cba7b9893c9a968a7 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 4 Dec 2021 21:05:14 -0500 Subject: Video tweaks, removed slashes too --- templates/page.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'templates') diff --git a/templates/page.tmpl b/templates/page.tmpl index 235d3aa9..65d12e3b 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -321,7 +321,8 @@ transcriptDiv.appendChild(transcriptLink) if (textTrack.kind === "chapters"){ textTrack.mode = 'hidden'; var video = trackElement.closest('video'); - var chapterList = trackElement.closest('.video-card').querySelector('ol'); + var chapterList = trackElement.closest('.vid').querySelector('ol'); + chapterList.innerHTML = ''; for (var i = 0; i < textTrack.cues.length; ++i) { cue = textTrack.cues[i], chapterName = cue.text, @@ -341,6 +342,7 @@ transcriptDiv.appendChild(transcriptLink) } textTrack.addEventListener("cuechange", function() { + if (!this.activeCues[0]) return; var currentLocation = this.activeCues[0].startTime; if (chapter = chapterList.querySelector('li[data-start="' + currentLocation + '"]')) { var locations = [].slice.call(chapterList.querySelectorAll("li")); @@ -354,7 +356,7 @@ transcriptDiv.appendChild(transcriptLink) } } - document.querySelectorAll('track[kind=chapters]').forEach(function(e) { e.addEventListener('load', function() { displayChapters(e); });}); + document.querySelectorAll('track[kind=chapters]').forEach(function(e) { displayChapters(e); e.addEventListener('load', function() { displayChapters(e); });}); // @license-end -- cgit v1.2.3