diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2020-12-29 12:09:57 -0600 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2020-12-29 12:09:57 -0600 |
commit | dd9c9e4225b220a30c132effba1bca2482dfa8cb (patch) | |
tree | 2fbd03dd7f5140e2eb485db9baf92a41ed1c62f3 /templates | |
parent | 6740f652e528840df09d414fd18a05b1550d4dd9 (diff) | |
download | emacsconf-wiki-dd9c9e4225b220a30c132effba1bca2482dfa8cb.tar.xz emacsconf-wiki-dd9c9e4225b220a30c132effba1bca2482dfa8cb.zip |
Fix: use parsing of html instead of data attribute for timestamp
Diffstat (limited to 'templates')
-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; |