Browse Source

Add indicator showing if hackerspace is open to menu (#6)

pull/8/head
bruegeln 1 year ago
parent
commit
7942d41d04
4 changed files with 38 additions and 1 deletions
  1. 1
    1
      config.toml
  2. 2
    0
      content/treffpunkt.md
  3. 10
    0
      layouts/partials/footer.html
  4. 25
    0
      static/js/script.js

+ 1
- 1
config.toml View File

@@ -31,7 +31,7 @@ pygmentsuseclasses = true

[[menu.main]]
name = "Treffpunkt"
pre = "<i class='fa fa-thumbs-up fa-fw'></i>"
pre = "<i id='my-thumbs-up' class='fa fa-thumbs-up fa-fw'></i>"
weight = 5
identifier = "treffpunkt"
url = "/treffpunkt/"

+ 2
- 0
content/treffpunkt.md View File

@@ -7,6 +7,8 @@ Im Technologiezentrum Konstanz treffen wir uns jeden Dienstag ab 19:00 um uns au

An anderen Wochentagen stehen die Räume unseren Mitgliedern zum Tüfteln zur Verfügung, es kann also sein, dass auch an einem anderen Tag jemand da ist. In unserem [Jabber-Chat]({{< ref "kontakt.md" >}}#jabber) kann man zum Beispiel nachfragen, ob jemand da ist.

Sollte im Menü neben dem Eintrag [Treffpunkt]({{< ref "treffpunkt.md" >}}) das <i class="fa fa-thumbs-up" style="color:#009900"/></i> in grün sichtbar sein so ist der Hackerspace offen.

Unsere Adresse lautet:

hacKNology e.V.<br />

+ 10
- 0
layouts/partials/footer.html View File

@@ -0,0 +1,10 @@
</div>
</div>
<script src="{{ .Site.BaseURL }}js/ui.js"></script>
<script src="{{ .Site.BaseURL }}js/script.js"></script>

{{ partial "google_analytics.html" . }}
{{ partial "piwik_analytics.html" . }}

</body>
</html>

+ 25
- 0
static/js/script.js View File

@@ -0,0 +1,25 @@
function getRequest(url)
{
var Httpreq = new XMLHttpRequest();
Httpreq.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var json_obj = JSON.parse(this.responseText);
if(1 == json_obj.state.open)
{
document.getElementById("my-thumbs-up").style.color = "#009900";
}
// default will be null, thus don't do anything
}
};
Httpreq.open("GET",url);
Httpreq.send(null);
}

function onReady()
{
getRequest("/spaceapi/status.json");
}
// check state of space after site has loaded completely
document.addEventListener("DOMContentLoaded", onReady);

Loading…
Cancel
Save