forked from hacknology/website
Add indicator showing if hackerspace is open to menu (#6)
parent
0345378ef4
commit
7942d41d04
@ -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> |
@ -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…
Reference in new issue