From 6891dbc467940fa6052694e98ef55e07b48a40b9 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 21:52:55 -0600 Subject: Add: Q&A video jump to time --- templates/page.tmpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index 3f3044a9..576f3d66 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -66,6 +66,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; // expects a string like "mm:ss" @@ -78,11 +79,14 @@ window.onload = function initScript() { mainVideo = document.getElementById("mainVideo"); + qnaVideo = document.getElementById("qnaVideo"); timestamps = document.getElementsByClassName("time-link"); let len = timestamps.length; for (let i = 0; i < len; i++) { timestamps[i].onclick = function () { - mainVideo.currentTime = parseSeconds(this.innerText) + const videoType = this.href.split("/").pop(); + const video = (videoType == "#mainVideo") ? mainVideo : qnaVideo; + video.currentTime = parseSeconds(this.innerText) }; } } -- cgit v1.2.3