logfilesrefsstats
path: root/script.js
diff options
context:
space:
mode:
authorinitframs <initframs@duck.com>2026-12-05 10:10:54 -0800
committerinitframs <initframs@duck.com>2026-12-05 10:10:54 -0800
commit590a5b1a109296882385b15e1750334cf2a5e872 (patch)
treeda7175759a960786382a62afa7fd129dfcf7600a /script.js
parent0ca521957fbe4b293b7a1ff799c651e7e796b9ae (diff)
feat: visitor counter
Diffstat (limited to 'script.js')
-rw-r--r--script.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/script.js b/script.js
index a25125e..2d4d7b6 100644
--- a/script.js
+++ b/script.js
@@ -38,7 +38,26 @@ function updateMarqueeApis() {
});
}
+function updateVisitorCounter() {
+ fetch("/api/visitor-counter")
+ .then(response => {
+ if (!response.ok) {
+ throw new Error("Visitor counter API error");
+ }
+ return response.text();
+ })
+ .then(count => {
+ document.querySelectorAll("#counter-number").forEach(el => {
+ el.textContent = count;
+ });
+ })
+ .catch(error => {
+ console.error("Visitor counter error:", error);
+ });
+}
+
updateClock();
updateMarqueeApis();
setInterval(updateClock, 1000);
-setInterval(updateMarqueeApis, 60000); \ No newline at end of file
+setInterval(updateMarqueeApis, 60000);
+updateVisitorCounter(); \ No newline at end of file