summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2026-10-15 12:54:58 -0400
committerSacha Chua <sacha@sachachua.com>2026-10-15 12:54:58 -0400
commite4cf4c157b2a7c5c71138cd4f50f551974225cb7 (patch)
treeedc2f3c95ef118c580463016e2fd147ea743c17c
parenta281e9da0a2d6b5c7fb0cbf4ced94ef17b20a97f (diff)
downloademacsconf-wiki-e4cf4c157b2a7c5c71138cd4f50f551974225cb7.tar.xz
emacsconf-wiki-e4cf4c157b2a7c5c71138cd4f50f551974225cb7.zip
Add local time to SVG link title for tooltip
-rw-r--r--script.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/script.js b/script.js
index 428adf3a..c127d3a9 100644
--- a/script.js
+++ b/script.js
@@ -55,7 +55,23 @@
}
// @license-end
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt txt CC0-1.0
- // Copyright (C) 2021, 2022 Sacha Chua
+// Copyright (C) 2021, 2022 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'};