summaryrefslogtreecommitdiff
path: root/public/my_uptime.js
diff options
context:
space:
mode:
authorKyren223 <contact@kyren.codes>2026-10-08 19:44:46 +0300
committerKyren223 <contact@kyren.codes>2026-10-08 19:44:46 +0300
commit9b03d2790b8b8db1b5a6755b6130f37e5f7f2455 (patch)
treea84f6e9cfe2b8aaf087d55830c938443f6be683e /public/my_uptime.js
parent6e70fe447ec9504757fbdc152b5b3697c9af8def (diff)
WIP
Diffstat (limited to 'public/my_uptime.js')
-rw-r--r--public/my_uptime.js18
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