diff options
| author | Sacha Chua <sacha@sachachua.com> | 2026-10-15 12:54:58 -0400 |
|---|---|---|
| committer | Sacha Chua <sacha@sachachua.com> | 2026-10-15 12:54:58 -0400 |
| commit | e4cf4c157b2a7c5c71138cd4f50f551974225cb7 (patch) | |
| tree | edc2f3c95ef118c580463016e2fd147ea743c17c /script.js | |
| parent | a281e9da0a2d6b5c7fb0cbf4ced94ef17b20a97f (diff) | |
| download | emacsconf-wiki-e4cf4c157b2a7c5c71138cd4f50f551974225cb7.tar.xz emacsconf-wiki-e4cf4c157b2a7c5c71138cd4f50f551974225cb7.zip | |
Add local time to SVG link title for tooltip
Diffstat (limited to '')
| -rw-r--r-- | script.js | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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'}; |
