summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/page.tmpl25
1 files changed, 14 insertions, 11 deletions
diff --git a/templates/page.tmpl b/templates/page.tmpl
index c196dedf..203f88ba 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -42,7 +42,7 @@
/*
SeekToTime - simple script to add video time jump functionality to timestamp links
- Copyright (C) 2020 Grant Shangreaux
+ Copyright (C) 2020-2024 Grant Shangreaux and Sacha Chua
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@@ -76,16 +76,19 @@
function handleSubtitleClick(event) {
var video = event.target.getAttribute('data-video');
- var start = event.target.getAttribute('data-start');
- var videoElem = document.getElementById(video);
- if (videoElem) {
- videoElem.currentTime = parseSeconds(start);
- videoElem.scrollIntoView();
- }
- if (event.preventDefault) {
- event.preventDefault();
- }
- }
+ var start = event.target.getAttribute('data-start');
+ const stickyVideo = document.querySelector('.transcript #' + video);
+ const indexCardVideo = document.querySelector('.vid #' + video);
+ if (stickyVideo && window.getComputedStyle(stickyVideo).display == 'block') {
+ stickyVideo.currentTime = parseSeconds(start);
+ } else if (indexCardVideo) {
+ indexCardVideo.currentTime = parseSeconds(start);
+ indexCardVideo.scrollIntoView();
+ }
+ if (event.preventDefault) {
+ event.preventDefault();
+ }
+ }
window.onload = function initScript() {
let subtitles = document.getElementsByClassName('subtitle');