From 9b03d2790b8b8db1b5a6755b6130f37e5f7f2455 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 8 Oct 2026 19:44:46 +0300 Subject: WIP --- public/my_uptime.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 public/my_uptime.js (limited to 'public/my_uptime.js') diff --git a/public/my_uptime.js b/public/my_uptime.js new file mode 100644 index 0000000..25f549a --- /dev/null +++ b/public/my_uptime.js @@ -0,0 +1,18 @@ +async function updateUptime() { + try { + const res = await fetch("/api/my-uptime"); + if (!res.ok) return; + const data = await res.json(); + + const text = document.getElementById("Uptime"); + + if (text && text.textContent !== data.uptime) { + text.textContent = data.uptime; + } + } catch (e) {} +} + +// Run on page load after all DOM elements loaded +DOMContentLoaded(updateUptime()); + +setInterval(updateUptime, 5 * 1000); // in ms -- cgit v1.3.1