From 2c2718ed12d07b7cdb5dfee60e146e214a8d6842 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Wed, 7 Oct 2020 10:55:25 -0500 Subject: Add status check --- .gitignore | 3 ++- index.html | 32 ++++++++++++++++++-------------- link-manager.js | 4 +++- status.js | 24 ++++++++++++++++++++++++ styles.css | 19 ++++++++++++++++++- template-config.js | 2 +- 6 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 status.js diff --git a/.gitignore b/.gitignore index a2d72a2..4f59fde 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -config.js \ No newline at end of file +config.js +*.swp diff --git a/index.html b/index.html index af6b4a8..6bf5acc 100644 --- a/index.html +++ b/index.html @@ -12,40 +12,43 @@
- 💰BUDGET + 💰BUDGET - 📅CALENDAR + 📅CALENDAR + + + ♟ī¸CHESS - 🗃ī¸FILE FEED + 🗃ī¸FILE FEED - 📁FILES + 📁FILES - - #ī¸âƒŖFOSSTODON + + #ī¸âƒŖFOSSTODON - 💾GITEA + 💾GITEA - 📰RSS + 📰RSS - đŸ“ēRSS VIDEO + đŸ“ēRSS VIDEO - 🐱‍đŸ’ģHN + 🐱‍đŸ’ģHN - 📖WIKI + 📖WIKI - 🌩ī¸WUNDERGROUND + 🌩ī¸WUNDERGROUND - đŸ“Ŋī¸YOUTUBE + đŸ“Ŋī¸YOUTUBE
@@ -101,6 +104,7 @@ + - \ No newline at end of file + diff --git a/link-manager.js b/link-manager.js index 14c6cbe..7772ee8 100644 --- a/link-manager.js +++ b/link-manager.js @@ -6,4 +6,6 @@ document.getElementById("files").href = `${FILES_URL}`; document.getElementById("filefeed").href = `${FILE_FEED_URL}`; document.getElementById("calendar").href = `${CALENDAR_URL}`; document.getElementById("budget").href = `${BUDGET_URL}`; -document.getElementById("wunderground").href = `https://www.wunderground.com/forecast/${WUNDERGROUND_STATION}` \ No newline at end of file +document.getElementById("chess").href = `${CHESS_URL}`; +document.getElementById("wunderground").href = `https://www.wunderground.com/forecast/${WUNDERGROUND_STATION}` + diff --git a/status.js b/status.js new file mode 100644 index 0000000..262a1b5 --- /dev/null +++ b/status.js @@ -0,0 +1,24 @@ +let urls = [ + WIKI_URL, RSS_URL, RSS_VIDEO_URL, GITEA_URL, FILES_URL, FILE_FEED_URL, CALENDAR_URL, BUDGET_URL +] +let ids = [ + "wiki", "rss", "rssvideo", "gitea", "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); + }) + }) + diff --git a/styles.css b/styles.css index 5e278e8..47a48e5 100644 --- a/styles.css +++ b/styles.css @@ -106,4 +106,21 @@ button { .forecast td { padding: 3px; font-size: 16px; -} \ No newline at end of file +} +span.status-up { + display: inline-block; + background-color: green; + width: 0.8em; + height: 0.8em; + border-radius: 50%; + margin-left: 1em; +} +span.status-down { + display: inline-block; + background-color: red; + width: 0.8em; + height: 0.8em; + border-radius: 50%; + margin-left: 1em; +} + diff --git a/template-config.js b/template-config.js index 46684f2..f5cbc2c 100644 --- a/template-config.js +++ b/template-config.js @@ -10,4 +10,4 @@ const FILES_URL = undefined; const FILE_FEED_URL = undefined; const CALENDAR_URL = undefined; const WEATHER_UNITS = "imperial"; -const BUDGET_URL = undefined; \ No newline at end of file +const BUDGET_URL = undefined; -- cgit v1.2.3