summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2024-12-22 21:24:52 -0500
committerSacha Chua <sacha@sachachua.com>2024-12-22 21:24:52 -0500
commite10d336fa2823431e4e25237700cbaf1bd1f5899 (patch)
tree729c7da04310245c7d617df82697ee7b6da135ca
parente18b5608456a1a649a323e04b0861430b4313b78 (diff)
downloademacsconf-wiki-e10d336fa2823431e4e25237700cbaf1bd1f5899.tar.xz
emacsconf-wiki-e10d336fa2823431e4e25237700cbaf1bd1f5899.zip
affect the sticky one
-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');