mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 06:52:17 +00:00
Passthrou messages from the Space API
This commit is contained in:
@@ -14,6 +14,7 @@ company = "Leigh Hackspace CIC"
|
|||||||
company_number = "09404083"
|
company_number = "09404083"
|
||||||
copyright_years = "2023"
|
copyright_years = "2023"
|
||||||
description = "Leigh Hackspace is a hackspace located in the north-west of England."
|
description = "Leigh Hackspace is a hackspace located in the north-west of England."
|
||||||
|
space_api_endpoint = "https://api.leighhack.org/space.json"
|
||||||
|
|
||||||
[params.social]
|
[params.social]
|
||||||
twitter = 'leigh_hackspace'
|
twitter = 'leigh_hackspace'
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
<div class="notification has-text-centered" id="hackspace-open">
|
<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>
|
</div>
|
||||||
<script>
|
<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);
|
var date = new Date(data.state.lastchange * 1000);
|
||||||
|
|
||||||
if (data.state.open) {
|
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');
|
$('div#hackspace-open').addClass('is-success');
|
||||||
} else {
|
} else {
|
||||||
$('span#hackspace_status').html('<b>Closed</b>');
|
$('span#hackspace_status').html('<b>Closed</b>');
|
||||||
|
|||||||
Reference in New Issue
Block a user