diff options
-rw-r--r-- | 2020/info/05.md | 5 | ||||
-rw-r--r-- | templates/page.tmpl | 21 | ||||
-rw-r--r-- | templates/vid.md | 2 |
3 files changed, 23 insertions, 5 deletions
diff --git a/2020/info/05.md b/2020/info/05.md index ad57c007..db18f39a 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 onclick="mainVideo.currentTime = 30.0">(00:30)</a> +<a href="#mainvideo" class="time-link" data-timestamp="30">(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,8 @@ 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) So when I want to share my music, I want to do it without +<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 their freedoms for anything. There's a lot more I could say about this diff --git a/templates/page.tmpl b/templates/page.tmpl index 28d650ad..3e94e1ae 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -37,6 +37,24 @@ </TMPL_LOOP> </TMPL_UNLESS> +<script> + var mainVideo; + var timestamps; + + window.onload = function initScript() { + console.log("initializing seek to time script"); + mainVideo = document.getElementById("mainVideo"); + timestamps = document.getElementsByClassName("time-link"); + len = timestamps.length; + for (i = 0; i < len; i++) { + seconds = parseFloat(timestamps[i].dataset["timestamp"]); + + timestamps[i].onclick = function () { + mainVideo.currentTime = seconds; + } + } + } +</script> </head> <body> @@ -48,7 +66,7 @@ <span> <span class="parentlinks"> <TMPL_LOOP PARENTLINKS> -<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>/ +<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>/ </TMPL_LOOP> </span> <span class="title"> @@ -221,6 +239,5 @@ Last edited <TMPL_VAR MTIME> <TMPL_IF HTML5></footer><TMPL_ELSE></div></TMPL_IF> <TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF> - </body> </html> diff --git a/templates/vid.md b/templates/vid.md index 37af8bf5..3d48a0bb 100644 --- a/templates/vid.md +++ b/templates/vid.md @@ -1,5 +1,5 @@ <div class="vid"> -<video controls preload="metadata" id="<TMPL_VAR vidid>" onload="var mainVideo = document.getElementById(<TMPL_VAR vidid>)"> +<video controls preload="metadata" id="<TMPL_VAR vidid>"> <source src="<TMPL_VAR src>" type="<TMPL_VAR type>" /> <TMPL_IF subtitles> <track label="English" kind="subtitles" srclang="en" src="<TMPL_VAR subtitles>" default /> |