summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2026-10-15 12:57:51 -0400
committerSacha Chua <sacha@sachachua.com>2026-10-15 12:57:51 -0400
commit97b9c64e9584e893f571f3507347e8430c05f649 (patch)
tree55cdd5bcbc6d3b519753f34d88b3c8ab1e63b558 /templates
parente4cf4c157b2a7c5c71138cd4f50f551974225cb7 (diff)
downloademacsconf-wiki-97b9c64e9584e893f571f3507347e8430c05f649.tar.xz
emacsconf-wiki-97b9c64e9584e893f571f3507347e8430c05f649.zip
Add timestamp script to page template
Diffstat (limited to 'templates')
-rw-r--r--templates/page.tmpl20
1 files changed, 18 insertions, 2 deletions
diff --git a/templates/page.tmpl b/templates/page.tmpl
index cc8357d7..85d94a42 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -288,8 +288,24 @@ Last edited <TMPL_VAR MTIME>
<script>
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt txt CC0-1.0
- // Copyright (C) 2021, 2022 Sacha Chua
-
+ // Copyright (C) 2021, 2022, 2026 Sacha Chua
+
+ function addLocalTimeToSVGs() {
+ var dateOptions = {
+ year: 'numeric', month: 'numeric', day: 'numeric',
+ hour: 'numeric', minute: 'numeric',
+ timeZoneName: 'short' };
+ document.querySelectorAll('svg a[data-start]').forEach((o) => {
+ let start = new Date(o.getAttribute('data-start'));
+ let title = o.querySelector('title');
+ if (title) {
+ title.textContent += ' = ' + start.toLocaleString([], dateOptions);
+ }
+ });
+}
+
+addLocalTimeToSVGs();
+
if (document.querySelector('.times')) {
var dateOptions = {dateStyle: 'short', timeStyle: 'short'};
var localStart = (new Date(document.querySelector('.times').getAttribute('start'))).toLocaleString([], dateOptions);