summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2023-09-24 21:02:20 -0400
committerSacha Chua <sacha@sachachua.com>2023-09-24 21:02:20 -0400
commitf93dd965b3629ebb8eaa728e5e5ff2711487b2cf (patch)
treefb499b75f950d11397be41e14c6d452aef2c62ff /templates
parentddb3534de3726c8483adeaa0aaadcee4214842b8 (diff)
downloademacsconf-wiki-f93dd965b3629ebb8eaa728e5e5ff2711487b2cf.tar.xz
emacsconf-wiki-f93dd965b3629ebb8eaa728e5e5ff2711487b2cf.zip
highlight talks based on URL
Diffstat (limited to 'templates')
-rw-r--r--templates/page.tmpl21
1 files changed, 20 insertions, 1 deletions
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>