summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:50:04 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2020-12-29 12:50:04 -0600
commit4626daf2d0f224d8654916ac03975ba21e431372 (patch)
tree4a558cb89423af3f2eab1945dbe4214aed46c50f
parent3e0f5fb62efc3de9c6c0139500f0d20e9f2c381f (diff)
downloademacsconf-wiki-4626daf2d0f224d8654916ac03975ba21e431372.tar.xz
emacsconf-wiki-4626daf2d0f224d8654916ac03975ba21e431372.zip
Clean: add some docs, clean up console logs, add LibreJS tag
-rw-r--r--templates/page.tmpl22
1 files changed, 13 insertions, 9 deletions
diff --git a/templates/page.tmpl b/templates/page.tmpl
index e4a1c9f2..58f18640 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -38,6 +38,17 @@
</TMPL_UNLESS>
<script>
+ /*
+ @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
+
+ This script enables wiki editors to create anchor tags with the class "time-link"
+ that will be parsed for seeking to specific time stamps in the main video on a page.
+ The tag should look like this:
+
+ <a href="#mainVideo" class="time-link">mm:ss</a>
+
+ This could be extended to accept hours in the time stamp as well, but currently does not.
+ */
var mainVideo;
var timestamps;
@@ -49,24 +60,17 @@
return (minutes * 60) + seconds;
}
- function seekToTime(seconds) {
- console.log("handler", seconds)
- mainVideo.currentTime = seconds;
- }
-
window.onload = function initScript() {
mainVideo = document.getElementById("mainVideo");
timestamps = document.getElementsByClassName("time-link");
len = timestamps.length;
for (i = 0; i < len; i++) {
- seconds = parseSeconds(timestamps[i].innerText);
- console.log("seconds: ", seconds);
-
timestamps[i].onclick = function () {
- seekToTime(parseSeconds(this.innerText))
+ mainVideo.currentTime = parseSeconds(this.innerText)
};
}
}
+ // @licence-end
</script>
</head>
<body>