summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-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>