diff options
-rw-r--r-- | local.css | 2 | ||||
-rw-r--r-- | templates/page.tmpl | 21 |
2 files changed, 22 insertions, 1 deletions
@@ -129,3 +129,5 @@ h1 { margin-top: 2em } } video { border: 1px solid gray; } .draft { border: 1px solid red; padding: 10px; background-color: LightPink } +svg a.highlight rect { stroke-width: 3px } +a.highlight { background-color: yellow } diff --git a/templates/page.tmpl b/templates/page.tmpl index b3600e2c..ba832af6 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -314,7 +314,7 @@ Last edited <TMPL_VAR MTIME> var localStart = (new Date(o.getAttribute('start'))).toLocaleString([], dateOptions); var localEnd = (new Date(o.getAttribute('end'))).toLocaleString([], dateOptions); o.setAttribute('title', 'Your local time: ~ ' + localStart + ' to ~ ' + localEnd); - } + }); } if (document.querySelector('a[name=transcript]')) { @@ -419,6 +419,25 @@ if (video) { } // @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'); + } + }); + } + + addEventListener('DOMContentLoaded', highlightTalks); + // @license-end </script> </body> </html> |