diff options
Diffstat (limited to '')
-rw-r--r-- | templates/page.tmpl | 11 |
1 files changed, 9 insertions, 2 deletions
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; |