summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/page.tmpl6
1 files changed, 4 insertions, 2 deletions
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
</script>