From dd9c9e4225b220a30c132effba1bca2482dfa8cb Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Tue, 29 Dec 2020 12:09:57 -0600 Subject: Fix: use parsing of html instead of data attribute for timestamp --- templates/page.tmpl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'templates/page.tmpl') diff --git a/templates/page.tmpl b/templates/page.tmpl index de7d488a..722fa45b 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -41,14 +41,21 @@ var mainVideo; var timestamps; + // expects a string like "mm:ss" + function parseSeconds(timeString) { + times = timesString.split(":"); + minutes = parseFloat(times[0]); + seconds = parseFloat(times[1]); + return (minutes * 60) + seconds; + } + window.onload = function initScript() { console.log("initializing seek to time script"); mainVideo = document.getElementById("mainVideo"); timestamps = document.getElementsByClassName("time-link"); len = timestamps.length; - var seconds; for (i = 0; i < len; i++) { - seconds = parseFloat(timestamps[i].dataset["timestamp"]); + seconds = parseSeconds(timestamps[i].innerText); timestamps[i].onclick = function () { mainVideo.currentTime = seconds; -- cgit v1.2.3