From e01eb580ac2040e34fc92a1da5f5156c0774ba8c Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 12 Dec 2021 01:24:30 -0500 Subject: Use simpler markup for chapters --- templates/chapters.md | 3 ++ templates/page.tmpl | 111 ++++++++++++++++++++++++++++---------------------- templates/vid.md | 6 +-- 3 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 templates/chapters.md (limited to 'templates') diff --git a/templates/chapters.md b/templates/chapters.md new file mode 100644 index 00000000..ec06bf02 --- /dev/null +++ b/templates/chapters.md @@ -0,0 +1,3 @@ +
+
+
diff --git a/templates/page.tmpl b/templates/page.tmpl index 65d12e3b..11606228 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -76,6 +76,17 @@ }, 0); } + function handleSubtitleClick(event) { + var video = event.target.attributes['data-video'].value; + var start = event.target.attributes['data-start'].value + var videoElem = document.getElementById(video); + if (videoElem) { + videoElem.currentTime = parseSeconds(start); + videoElem.scrollIntoView(); + } + event.preventDefault(); + } + window.onload = function initScript() { mainVideo = document.getElementById("mainVideo"); qnaVideo = document.getElementById("qnaVideo"); @@ -88,16 +99,6 @@ video.currentTime = parseSeconds(this.innerText) }; } - handleSubtitleClick = function(event) { - video = event.target.attributes['data-video'].value; - start = event.target.attributes['data-start'].value - videoElem = document.getElementById(video); - if (videoElem) { - videoElem.currentTime = parseSeconds(start); - videoElem.scrollIntoView(); - } - } - let subtitles = document.getElementsByClassName('subtitle'); for (let i = 0; i < subtitles.length; i++) { subtitles[i].onclick = handleSubtitleClick; @@ -315,48 +316,62 @@ transcriptDiv.appendChild(transcriptLink) diff --git a/templates/vid.md b/templates/vid.md index b50349c4..2a48e3a0 100644 --- a/templates/vid.md +++ b/templates/vid.md @@ -1,6 +1,6 @@
-
-- cgit v1.2.3