diff options
| author | initframs <initframs@duck.com> | 2026-11-08 08:39:06 -0800 |
|---|---|---|
| committer | initframs <initframs@duck.com> | 2026-11-08 08:39:06 -0800 |
| commit | cd9aada1c90b779f45453efefcfbda84f565adef (patch) | |
| tree | 08b1b41a053d6b8fd412afb057d0f5afb57a82a0 /script.js | |
| parent | c9993279fe16463a54a1e3f3a803fe0d603dea92 (diff) | |
first commit
Diffstat (limited to 'script.js')
| -rw-r--r-- | script.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/script.js b/script.js new file mode 100644 index 0000000..a25125e --- /dev/null +++ b/script.js @@ -0,0 +1,44 @@ +function updateClock() { + const now = new Date(); + + document.querySelectorAll("#clock").forEach(el => { + el.textContent = now.toLocaleTimeString(); + }); + + document.querySelectorAll("#date").forEach(el => { + el.textContent = now.toLocaleDateString(); + }); +} + +function updateMarqueeApis() { + fetch("https://www.mapforham.com/hf-propagation/data/solar.json") + .then(response => response.json()) + .then(data => { + console.log("Got data:", data); + console.log(data.solar_flux); + + document.querySelectorAll("#sfi").forEach(el => { + el.textContent = data.solar_flux; + }); + document.querySelectorAll("#band40").forEach(el => { + el.textContent = data.bands_detail[3].day + "/" + data.bands_detail[3].night; + }); + document.querySelectorAll("#band20").forEach(el => { + el.textContent = data.bands_detail[5].day + "/" + data.bands_detail[5].night; + }); + document.querySelectorAll("#band80").forEach(el => { + el.textContent = data.bands_detail[1].day + "/" + data.bands_detail[1].night; + }); + document.querySelectorAll("#band10").forEach(el => { + el.textContent = data.bands_detail[9].day + "/" + data.bands_detail[9].night; + }); + }) + .catch(error => { + console.error("api error:", error); + }); +} + +updateClock(); +updateMarqueeApis(); +setInterval(updateClock, 1000); +setInterval(updateMarqueeApis, 60000);
\ No newline at end of file |
