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 --- 2020/info/05.md | 4 ++-- templates/page.tmpl | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/2020/info/05.md b/2020/info/05.md index db18f39a..78ac43ea 100644 --- a/2020/info/05.md +++ b/2020/info/05.md @@ -118,7 +118,7 @@ with Unabridged Software in Lincoln, Nebraska. Long time Emacs user, relatively new Emacs hacker. Hopefully, I'll be able to show you my workflow, with how I publish music with Emacs. All right. -(00:30) +(00:30) So as a musician, I would like to publish my music online. I could publish with popular online music services, but I'm more of a DIY-type, so I chose to go ahead and publish with Emacs. What's the @@ -134,7 +134,7 @@ something that should be shared and should be freely enjoyed by everyone. Of course, artists should be compensated as well, but that's a whole different topic. -(01:39) +(01:39) So when I want to share my music, I want to do it without impacting anyone's freedom. Using GNU software like Emacs is a good way that I can ensure that I won't be requiring people to sign away 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