Skip to content

Commit

Permalink
add door status to other pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Molly Benkö committed Mar 20, 2023
1 parent 38b0b3e commit 1daed57
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
20 changes: 20 additions & 0 deletions location-de.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ <h2>Hackspace im Herzen Wiens</h2>
<li><a href="https://metalab.at/wiki/Impressum">Impressum</a></li>
<li><a href="location.html">🇬🇧</a></li>
<li><a href="#">🇦🇹</a></li>
<li>Tür ist <span id="door">???</span></li>
<!--determine door status-->
<script type="text/javascript">
element = document.getElementById("door")
url = "http://eingang.metalab.at/status.json"
request = new XMLHttpRequest()
request.open("GET", url)
request.send()
element.style.backgroundColor = "#a5a511";
request.onreadystatechange = (e) => {
obj = JSON.parse(request.responseText)
if (obj.status == "open"){
element.innerHTML="AUF"
element.style.backgroundColor="green"
} else if (obj.status == "closed"){
element.innerHTML="ZU";
element.style.backgroundColor= "darkred";
}
}
</script>
</ul>
</nav>
<main>
Expand Down
20 changes: 20 additions & 0 deletions location.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ <h2>Hackspace in the Heart of Vienna</h2>
<li><a href="https://metalab.at/wiki/Impressum">Imprint</a></li>
<li><a href="#">🇬🇧</a></li>
<li><a href="location-de.html">🇦🇹</a></li>
<li>Door is <span id="door">???</span></li>
<!--determine door status-->
<script type="text/javascript">
element = document.getElementById("door")
url = "http://eingang.metalab.at/status.json"
request = new XMLHttpRequest()
request.open("GET", url)
request.send()
element.style.backgroundColor = "#a5a511";
request.onreadystatechange = (e) => {
obj = JSON.parse(request.responseText)
if (obj.status == "open"){
element.innerHTML="OPEN"
element.style.backgroundColor="green"
} else if (obj.status == "closed"){
element.innerHTML="CLOSED";
element.style.backgroundColor= "darkred";
}
}
</script>
</ul>
</nav>
<main>
Expand Down
20 changes: 20 additions & 0 deletions rooms-de.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ <h2>Hackspace im Herzen Wiens</h2>
<li><a href="https://metalab.at/wiki/Impressum">Impressum</a></li>
<li><a href="rooms.html">🇬🇧</a></li>
<li><a href="#">🇦🇹</a></li>
<li>Tür ist <span id="door">???</span></li>
<!--determine door status-->
<script type="text/javascript">
element = document.getElementById("door")
url = "http://eingang.metalab.at/status.json"
request = new XMLHttpRequest()
request.open("GET", url)
request.send()
element.style.backgroundColor = "#a5a511";
request.onreadystatechange = (e) => {
obj = JSON.parse(request.responseText)
if (obj.status == "open"){
element.innerHTML="AUF"
element.style.backgroundColor="green"
} else if (obj.status == "closed"){
element.innerHTML="ZU";
element.style.backgroundColor= "darkred";
}
}
</script>
</ul>
</nav>
<main>
Expand Down
20 changes: 20 additions & 0 deletions rooms.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ <h2>Hackspace in the Heart of Vienna</h2>
<li><a href="https://metalab.at/wiki/Impressum">Imprint</a></li>
<li><a href="#">🇬🇧</a></li>
<li><a href="rooms-de.html">🇦🇹</a></li>
<li>Door is <span id="door">???</span></li>
<!--determine door status-->
<script type="text/javascript">
element = document.getElementById("door")
url = "http://eingang.metalab.at/status.json"
request = new XMLHttpRequest()
request.open("GET", url)
request.send()
element.style.backgroundColor = "#a5a511";
request.onreadystatechange = (e) => {
obj = JSON.parse(request.responseText)
if (obj.status == "open"){
element.innerHTML="OPEN"
element.style.backgroundColor="green"
} else if (obj.status == "closed"){
element.innerHTML="CLOSED";
element.style.backgroundColor= "darkred";
}
}
</script>
</ul>
</nav>
<main>
Expand Down

0 comments on commit 1daed57

Please sign in to comment.