blob: 2d4d7b6d7d7846e2443fb114a695fc1825c98963 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
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);
});
}
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);
updateVisitorCounter();
|