summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:09:57 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:09:57 -0600
commitdd9c9e4225b220a30c132effba1bca2482dfa8cb (patch)
tree2fbd03dd7f5140e2eb485db9baf92a41ed1c62f3
parent6740f652e528840df09d414fd18a05b1550d4dd9 (diff)
downloademacsconf-wiki-dd9c9e4225b220a30c132effba1bca2482dfa8cb.tar.xz
emacsconf-wiki-dd9c9e4225b220a30c132effba1bca2482dfa8cb.zip
Fix: use parsing of html instead of data attribute for timestamp
Diffstat (limited to '')
-rw-r--r--2020/info/05.md4
-rw-r--r--templates/page.tmpl11
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.
-<a href="#mainvideo" class="time-link" data-timestamp="30">(00:30)</a>
+(<a href="#mainVideo" class="time-link">00:30</a>)
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.
-<a href="#mainvideo" class="time-link" data-timestamp="99">(01:39)</a>
+(<a href="#mainVideo" class="time-link" data-timestamp="99">01:39</a>)
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;