summaryrefslogtreecommitdiffstats
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
parentddb3534de3726c8483adeaa0aaadcee4214842b8 (diff)
downloademacsconf-wiki-f93dd965b3629ebb8eaa728e5e5ff2711487b2cf.tar.xz
emacsconf-wiki-f93dd965b3629ebb8eaa728e5e5ff2711487b2cf.zip
highlight talks based on URL
Diffstat (limited to '')
-rw-r--r--local.css2
-rw-r--r--templates/page.tmpl21
2 files changed, 22 insertions, 1 deletions
diff --git a/local.css b/local.css
index cdc9a1eb..69220c3e 100644
--- a/local.css
+++ b/local.css
@@ -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>