diff --git a/config.toml b/config.toml index 4e6bf47..e3b5527 100644 --- a/config.toml +++ b/config.toml @@ -14,7 +14,6 @@ company = "Leigh Hackspace CIC" company_number = "09404083" copyright_years = "2023" description = "Leigh Hackspace is a hackspace located in the north-west of England." -space_api_endpoint = "https://api.leighhack.org/space.json" [params.social] twitter = 'leigh_hackspace' diff --git a/content/_index.md b/content/_index.md index 96bc062..b1f96c6 100644 --- a/content/_index.md +++ b/content/_index.md @@ -4,7 +4,11 @@ subtitle: Leigh Hackspace is a social enterprise created for the benefit of our layout: home --- -{{< open >}} +{{< rawhtml >}} +
+Leigh Hackspace is currently Closed +
+{{}} | Day | Opening Times | | --------- | ------------- | diff --git a/themes/lhs/assets/js/site.js b/themes/lhs/assets/js/site.js index 1eeaffe..6b6eae4 100644 --- a/themes/lhs/assets/js/site.js +++ b/themes/lhs/assets/js/site.js @@ -1,24 +1,26 @@ -document.addEventListener('DOMContentLoaded', () => { +$(document).ready(function () { + $(".navbar-burger").click(function () { + $(".navbar-burger").toggleClass("is-active"); + $(".navbar-menu").toggleClass("is-active"); + }); - // Get all "navbar-burger" elements - const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); + if ($('span#hackspace-status').length) { + $.getJSON("https://api.leighhack.org/space.json", function (data) { + var date = new Date(data.state.lastchange * 1000); - // Check if there are any navbar burgers - if ($navbarBurgers.length > 0) { - - // Add a click event on each of them - $navbarBurgers.forEach(el => { - el.addEventListener('click', () => { - - // Get the target from the "data-target" attribute - const target = el.dataset.target; - const $target = document.getElementById(target); - - // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu" - el.classList.toggle('is-active'); - $target.classList.toggle('is-active'); - - }); + if (data.state.open) { + message = 'Open' + 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('Closed'); + } }); } -}); \ No newline at end of file +}); + + + diff --git a/themes/lhs/layouts/shortcodes/open.html b/themes/lhs/layouts/shortcodes/open.html deleted file mode 100644 index c305fa6..0000000 --- a/themes/lhs/layouts/shortcodes/open.html +++ /dev/null @@ -1,19 +0,0 @@ -
-Leigh Hackspace is currently Closed -
- \ No newline at end of file