aboutsummaryrefslogtreecommitdiff
path: root/status.js
blob: 4ccabe38326edc7d1a20d47e0f8addd4b0eb5ba1 (plain)
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);
        }) 
    })