1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
let urls = [
WIKI_URL, RSS_URL, RSS_VIDEO_URL, GIT_URL, FILES_URL, FILE_FEED_URL, CALENDAR_URL, BUDGET_URL
]
let ids = [
"wiki", "rss", "rssvideo", "git", "files", "filefeed", "calendar", "budget"
]
let status_url = `http://localhost:8080?${urls.join("&")}`
fetch(status_url)
.then( response => response.text())
.then( response => {
response.split("\n").forEach((el, i)=> {
if(el == "") { return }
console.log(urls[i], ids[i], el)
let htmlEl = document.getElementById(ids[i])
let newEl = document.createElement("span")
if(el == "up"){
newEl.className = "status-up"
} else {
newEl.className = "status-down"
}
htmlEl.insertBefore(newEl, htmlEl.lastChild);
})
})
|