diff options
author | Sacha Chua <sacha@sachachua.com> | 2024-12-22 20:46:51 -0500 |
---|---|---|
committer | Sacha Chua <sacha@sachachua.com> | 2024-12-22 20:46:51 -0500 |
commit | 6cdb2258e2200ff45a66c2c87c6605c796600621 (patch) | |
tree | 0247ca6dde1c59ab69920f54b15a9dbd0fb53180 /templates | |
parent | f4194e0e4264e40a0318b5216e071ba6c6ef45f2 (diff) | |
download | emacsconf-wiki-6cdb2258e2200ff45a66c2c87c6605c796600621.tar.xz emacsconf-wiki-6cdb2258e2200ff45a66c2c87c6605c796600621.zip |
tinker
Diffstat (limited to '')
-rw-r--r-- | templates/page.tmpl | 85 |
1 files changed, 51 insertions, 34 deletions
diff --git a/templates/page.tmpl b/templates/page.tmpl index f74e9e2b..05fade46 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -393,49 +393,66 @@ Last edited <TMPL_VAR MTIME> } elem.parentNode.replaceChild(list, elem); } - - document.querySelectorAll('pre.chapters').forEach(displayChapters); + + document.querySelectorAll('pre.chapters').forEach(displayChapters); var video = document.querySelector('video.reload'); -if (video) { - var myVar = setInterval(reloadAsNeeded, 1000); - var oldTime = ''; - function reloadAsNeeded() { - if ((video.paused != true && (video.currentTime - oldTime) == 0 && video.currentTime != 0)) { - var source = video.querySelector('source'); - var oldVideo = source.src; - source.src = ''; - source.src = oldVideo; - video.load(); - video.play(); - } - oldTime = video.currentTime; - }; -} + if (video) { + var myVar = setInterval(reloadAsNeeded, 1000); + var oldTime = ''; + function reloadAsNeeded() { + if ((video.paused != true && (video.currentTime - oldTime) == 0 && video.currentTime != 0)) { + var source = video.querySelector('source'); + var oldVideo = source.src; + source.src = ''; + source.src = oldVideo; + video.load(); + video.play(); + } + oldTime = video.currentTime; + }; + } + + /* videoType: mainVideo, qanda */ + function addStickyVideo(videoType) { + const transcriptDiv = document.querySelector('.transcript-' + videoType); + const video = document.querySelector('.vid.' + videoType); + if (!video || !transcriptDiv) return; + if (transcriptDiv.querySelector('video')) return; // already has it + // TODO: Make a copy of the video and place it at the start of the btranscript div, positioned to the left, and sticky, but only on large screens. + const videoCopy = video.cloneNode(true); + transcriptDiv.prepend(videoCopy); + videoCopy.classList.add('sticky-video'); + // TODO: fix the ID + } // @license-end // @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt txt CC0-1.0 - // Copyright (c) 2023 Sacha Chua - CC0 Public Domain - function highlightTalks() { - // highlight any talk mentioned in the highlight URL parameter - var params = new URLSearchParams(window.location.search); - if (!params.get('highlight')) return; - var talks = params.get('highlight').split(',').filter(function(o) { return o.match(/^[-a-z0-9]+$/); }); - var regexp = new RegExp('/talks/(' + talks.join('|') + ')/?$'); - document.querySelectorAll('a[href]').forEach(function(link) { - console.debug(link.getAttribute('href'), link.getAttribute('href').match(regexp)); - if (link.getAttribute('href').match(regexp)) { - console.debug(link); - link.classList.add('highlight'); - } - }); - } + // Copyright (c) 2023 Sacha Chua - CC0 Public Domain + function highlightTalks() { + // highlight any talk mentioned in the highlight URL parameter + var params = new URLSearchParams(window.location.search); + if (!params.get('highlight')) return; + var talks = params.get('highlight').split(',').filter(function(o) { return o.match(/^[-a-z0-9]+$/); }); + var regexp = new RegExp('/talks/(' + talks.join('|') + ')/?$'); + document.querySelectorAll('a[href]').forEach(function(link) { + console.debug(link.getAttribute('href'), link.getAttribute('href').match(regexp)); + if (link.getAttribute('href').match(regexp)) { + console.debug(link); + link.classList.add('highlight'); + } + }); + } - addEventListener('DOMContentLoaded', highlightTalks); - // @license-end + addEventListener('DOMContentLoaded', highlightTalks); + addEventListener('DOMContentLoaded', function() { + addStickyVideo('mainVideo'); + addStickyVideo('qanda'); + }); + // @license-end </script> </body> </html> |