diff options
Diffstat (limited to '')
-rw-r--r-- | templates/page.tmpl | 21 | ||||
-rw-r--r-- | templates/vid.md | 2 |
2 files changed, 20 insertions, 3 deletions
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 /> |