Add open/closed notification

This commit is contained in:
2023-11-05 15:38:36 +00:00
parent 3655261d53
commit b73be288a3
3 changed files with 32 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://kit.fontawesome.com/589b48ea08.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="/css/bulma.min.css">
<link rel="stylesheet" href="/css/leighhack.css" type="text/css">

View File

@@ -0,0 +1,15 @@
<div class="notification has-text-centered" id="hackspace-open">
Leigh Hackspace is currently <span id="hackspace_status">Closed</span>
</div>
<script>
$.getJSON("https://api.leighhack.org/space.json", function (data) {
var date = new Date(data.state.lastchange * 1000);
if (data.state.open) {
$('span#hackspace_status').html('<b>Open</b>');
$('div#hackspace-open').addClass('is-success');
} else {
$('span#hackspace_status').html('<b>Closed</b>');
}
});
</script>