diff options
| author | Kyren223 <contact@kyren.codes> | 2026-10-08 19:44:46 +0300 |
|---|---|---|
| committer | Kyren223 <contact@kyren.codes> | 2026-10-08 19:44:46 +0300 |
| commit | 9b03d2790b8b8db1b5a6755b6130f37e5f7f2455 (patch) | |
| tree | a84f6e9cfe2b8aaf087d55830c938443f6be683e /public/my_uptime.js | |
| parent | 6e70fe447ec9504757fbdc152b5b3697c9af8def (diff) | |
WIP
Diffstat (limited to 'public/my_uptime.js')
| -rw-r--r-- | public/my_uptime.js | 18 |
1 files changed, 18 insertions, 0 deletions
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 |
