mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 05:42:17 +00:00
Passthrou messages from the Space API
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
<div class="notification has-text-centered" id="hackspace-open">
|
||||
Leigh Hackspace is currently <span id="hackspace_status">Closed</span>
|
||||
Leigh Hackspace is currently <span id="hackspace-status">Closed</span>
|
||||
</div>
|
||||
<script>
|
||||
$.getJSON("https://api.leighhack.org/space.json", function (data) {
|
||||
$.getJSON("{{ .Site.Params.space_api_endpoint }}", function (data) {
|
||||
var date = new Date(data.state.lastchange * 1000);
|
||||
|
||||
if (data.state.open) {
|
||||
$('span#hackspace_status').html('<b>Open</b>');
|
||||
message = '<b>Open<b>'
|
||||
if ('message' in data.state) {
|
||||
message = message + ': ' + data.state.message;
|
||||
}
|
||||
$('span#hackspace-status').html(message);
|
||||
$('div#hackspace-open').addClass('is-success');
|
||||
} else {
|
||||
$('span#hackspace_status').html('<b>Closed</b>');
|
||||
|
||||
Reference in New Issue
Block a user