From d0b7b6e691f116545da98712e55df8c93a60e55c Mon Sep 17 00:00:00 2001
From: tvluke <tvluke@chaotikum.org>
Date: Sat, 10 Jun 2023 13:32:29 +0200
Subject: [PATCH] only show avatars if space open

---
 _includes/nav-header.html | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/_includes/nav-header.html b/_includes/nav-header.html
index 28cece86..fb20ff2a 100644
--- a/_includes/nav-header.html
+++ b/_includes/nav-header.html
@@ -46,6 +46,8 @@ applyToggle('.list--nav', '.button', 640)
 </script>
 
 <script>
+var space_is_open = false;
+
 $(document).ready(function(){
   spaceopen();
   nextevent();
@@ -57,6 +59,7 @@ function spaceopen() {
 
   $.get( "https://status.nobreakspace.org/spaceapi.json", function( data ) {
     if(data.open) {
+      space_is_open = true;
       $("#spaceopen").css( "border", "3px solid green" );
       $("#spaceopen").html("<div style='float:left'><img src='{{ site.baseurl }}/assets/open.png' width='35'></div>Der Nbsp ist offen!<br><div style='text-align: right;'><a href='https://status.nobreakspace.org' target='_blank' style='color: #EAEAEA;'>Status</a></div>");
       $("#spaceopenmobile").css( "border", "3px solid green" );
@@ -93,6 +96,7 @@ function shuffleArray(array) {
 }
 
 function presence() {
+  if(space_is_open) {
     $.getJSON( "{{site.presence_service}}", function( data ) {
       console.log(data)
       shuffleArray(data);
@@ -115,6 +119,7 @@ function presence() {
         $("#presence_mobile" ).append('<img class="gravatar" src="https://chaotikum.org/assets/presence/plusplus.png" style="margin-left: -5px;"/>');
       }
     });
+  }
 }
 </script>
 
-- 
GitLab