diff options
| author | initframs <initframs@duck.com> | 2026-12-05 10:10:54 -0800 |
|---|---|---|
| committer | initframs <initframs@duck.com> | 2026-12-05 10:10:54 -0800 |
| commit | 590a5b1a109296882385b15e1750334cf2a5e872 (patch) | |
| tree | da7175759a960786382a62afa7fd129dfcf7600a | |
| parent | 0ca521957fbe4b293b7a1ff799c651e7e796b9ae (diff) | |
feat: visitor counter
| -rw-r--r-- | script.js | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -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 |
