From 7942d41d04fa2cee099455f7235d4168322a16c2 Mon Sep 17 00:00:00 2001 From: BruegelN Date: Sat, 21 Jul 2018 17:45:19 +0000 Subject: [PATCH] Add indicator showing if hackerspace is open to menu (#6) --- config.toml | 2 +- content/treffpunkt.md | 2 ++ layouts/partials/footer.html | 10 ++++++++++ static/js/script.js | 25 +++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/footer.html create mode 100644 static/js/script.js diff --git a/config.toml b/config.toml index c7be3a0..d056e12 100644 --- a/config.toml +++ b/config.toml @@ -31,7 +31,7 @@ pygmentsuseclasses = true [[menu.main]] name = "Treffpunkt" - pre = "" + pre = "" weight = 5 identifier = "treffpunkt" url = "/treffpunkt/" diff --git a/content/treffpunkt.md b/content/treffpunkt.md index 129973b..bcd7133 100644 --- a/content/treffpunkt.md +++ b/content/treffpunkt.md @@ -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 in grün sichtbar sein so ist der Hackerspace offen. + Unsere Adresse lautet: hacKNology e.V.
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..d1b8f98 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,10 @@ + + + + + +{{ partial "google_analytics.html" . }} +{{ partial "piwik_analytics.html" . }} + + + diff --git a/static/js/script.js b/static/js/script.js new file mode 100644 index 0000000..88ea1f8 --- /dev/null +++ b/static/js/script.js @@ -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); \ No newline at end of file