diff mod_http_muc_log/static/timestamps.js @ 5104:d4b0a995e5e3

mod_http_muc_log: Move CSS and JS out of template This allows applying different cache and security policies to the static resources, while reducing the size of all pages.
author Kim Alvefur <zash@zash.se>
date Sun, 04 Dec 2022 22:10:07 +0100
parents mod_http_muc_log/res/http_muc_log.html@d55b10878e43
children 630887a50a7d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_http_muc_log/static/timestamps.js	Sun Dec 04 22:10:07 2022 +0100
@@ -0,0 +1,19 @@
+/*
+* Local timestamps
+*/
+(function () {
+var timeTags = document.getElementsByTagName("time");
+var i = 0, tag, date;
+while(timeTags[i]) {
+tag = timeTags[i++];
+if(date = tag.getAttribute("datetime")) {
+date = new Date(date);
+tag.textContent = date.toLocaleTimeString(navigator.language);
+tag.setAttribute("title", date.toString());
+}
+}
+document.forms[0].elements.p.addEventListener("change", function() {
+document.forms[0].submit();
+});
+})();
+