From 49b7eb901ed7ad953d41d43358dec13ef3e1a9d2 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 22 Dec 2024 20:35:09 -0500 Subject: hah, it turns out I swapped the IDs in JS --- templates/page.tmpl | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 906e246a..f74e9e2b 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -65,9 +65,7 @@ This could be extended to accept hours in the time stamp as well, but currently does not. */ - let mainVideo; - let qnaVideo; // some pages have a questions and answers video - let timestamps; + let timestamps; // expects a string like "mm:ss.mmm" function parseSeconds(timeString) { @@ -79,10 +77,6 @@ function handleSubtitleClick(event) { var video = event.target.getAttribute('data-video'); var start = event.target.getAttribute('data-start'); - let m = video.match(/(mainVideo|qnaVideo)-(.*)/); - if (m) { - video = m[2] + '-' + m[1]; - } var videoElem = document.getElementById(video); if (videoElem) { videoElem.currentTime = parseSeconds(start); @@ -94,22 +88,10 @@ } window.onload = function initScript() { - mainVideo = document.getElementById("mainVideo"); - qnaVideo = document.getElementById("qnaVideo"); - timestamps = document.getElementsByClassName("time-link"); - var len = timestamps.length; - for (let i = 0; i < len; i++) { - timestamps[i].onclick = function () { - videoType = this.href.split("/").pop(); - video = (videoType == "#mainVideo") ? mainVideo : qnaVideo; - video.currentTime = parseSeconds(this.innerText) - }; - } let subtitles = document.getElementsByClassName('subtitle'); for (let i = 0; i < subtitles.length; i++) { subtitles[i].onclick = handleSubtitleClick; } - } // @license-end -- cgit v1.2.3