diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-10-07 10:55:25 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-10-07 10:55:25 -0500 |
commit | 2c2718ed12d07b7cdb5dfee60e146e214a8d6842 (patch) | |
tree | e03670981ac9b8b12772461d5f273066c098d2ef | |
parent | 1f1f48db76b5b99092b44d52f1ed7af327034d71 (diff) |
Add status check
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | index.html | 32 | ||||
-rw-r--r-- | link-manager.js | 4 | ||||
-rw-r--r-- | status.js | 24 | ||||
-rw-r--r-- | styles.css | 19 | ||||
-rw-r--r-- | template-config.js | 2 |
6 files changed, 66 insertions, 18 deletions
@@ -1 +1,2 @@ -config.js
\ No newline at end of file +config.js +*.swp @@ -12,40 +12,43 @@ <span class="search"><input id="searchInput" placeholder="Search..."><button id="searchBtn">Go</button></span> <div class="items"> <a class="item" id="budget"> - <span class="icon">đ°</span>BUDGET + <span class="icon">đ°</span><span>BUDGET</span> </a> <a class="item" id="calendar"> - <span class="icon">đ
</span>CALENDAR + <span class="icon">đ
</span><span>CALENDAR</span> + </a> + <a class="item" id="chess"> + <span class="icon">âī¸</span><span>CHESS</span> </a> <a class="item" id="filefeed"> - <span class="icon">đī¸</span>FILE FEED + <span class="icon">đī¸</span><span>FILE FEED</span> </a> <a class="item" id="files"> - <span class="icon">đ</span>FILES + <span class="icon">đ</span><span>FILES</span> </a> - <a class="item" href="https://fosstodon.org"> - <span class="icon">#ī¸âŖ</span>FOSSTODON + <a class="item" id="mastodon" href="https://fosstodon.org"> + <span class="icon">#ī¸âŖ</span><span>FOSSTODON</span> </a> <a class="item" id="gitea"> - <span class="icon">đž</span>GITEA + <span class="icon">đž</span><span>GITEA</span> </a> <a class="item" id="rss"> - <span class="icon">đ°</span>RSS + <span class="icon">đ°</span><span>RSS</span> </a> <a class="item" id="rssvideo"> - <span class="icon">đē</span>RSS VIDEO + <span class="icon">đē</span><span>RSS VIDEO</span> </a> <a class="item" href="https://news.ycombinator.com/"> - <span class="icon">đąâđģ</span>HN + <span class="icon">đąâđģ</span><span>HN</span> </a> <a class="item" id="wiki"> - <span class="icon">đ</span>WIKI + <span class="icon">đ</span><span>WIKI</span> </a> <a class="item" id="wunderground"> - <span class="icon">đŠī¸</span>WUNDERGROUND + <span class="icon">đŠī¸</span><span>WUNDERGROUND</span> </a> <a class="item" href="https://www.youtube.com/feed/subscriptions"> - <span class="icon">đŊī¸</span>YOUTUBE + <span class="icon">đŊī¸</span><span>YOUTUBE</span> </a> </div> <table class="weather"> @@ -101,6 +104,7 @@ <script src="link-manager.js"></script> <script src="weather-manager.js"></script> <script src="search-manager.js"></script> + <script src="status.js"></script> </body> -</html>
\ No newline at end of file +</html> 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); + }) + }) + @@ -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; |