aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-10-07 10:55:25 -0500
committerMark Powers <markppowers0@gmail.com>2020-10-07 10:55:25 -0500
commit2c2718ed12d07b7cdb5dfee60e146e214a8d6842 (patch)
treee03670981ac9b8b12772461d5f273066c098d2ef
parent1f1f48db76b5b99092b44d52f1ed7af327034d71 (diff)
Add status check
-rw-r--r--.gitignore3
-rw-r--r--index.html32
-rw-r--r--link-manager.js4
-rw-r--r--status.js24
-rw-r--r--styles.css19
-rw-r--r--template-config.js2
6 files changed, 66 insertions, 18 deletions
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 @@
<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);
+ })
+ })
+
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;