diff --git a/content/facilities/fabrication/index.md b/content/facilities/fabrication/index.md
index f3f866d..abe0e22 100644
--- a/content/facilities/fabrication/index.md
+++ b/content/facilities/fabrication/index.md
@@ -10,3 +10,7 @@ subtitle: Use 3D printers and laser cutters to bring your creations to life.
Leigh Hackspace currently operates three 3D printers, a Anycubic Vyper, a Ender 3 Pro, and a Makerbot Replicator 2. Between them they're able to print most things you can think of. We also hold a stock of filament that is available for use by members.
We also have a CAD system available for member use, everything needed to get you started on the 3D printers and laser engraver is ready to go on the system.
+
+### Printer Status
+
+{{< printers >}}
\ No newline at end of file
diff --git a/themes/lhs/assets/js/site.js b/themes/lhs/assets/js/site.js
index dda0913..183552f 100644
--- a/themes/lhs/assets/js/site.js
+++ b/themes/lhs/assets/js/site.js
@@ -18,6 +18,27 @@ $(document).ready(function () {
}
});
}
+
+ function titleCase(word) {
+ return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
+ }
+
+ // 'printers' shortcode
+ if ($('div#printer-status').length) {
+ $.getJSON("https://api.leighhack.org/space.json", function (data) {
+ if (data.sensors.ext_3d_printers.length) {
+ data.sensors.ext_3d_printers.forEach(function (val, indx){
+ var obj = $($("template#printer-block").html());
+ console.log(val);
+ console.log(obj);
+ console.log(obj.find('#printer-name'))
+ obj.find('#printer-name').html(val['name']);
+ obj.find('#printer-status').html(titleCase(val['state']));
+ $('div#printer-status').append(obj);
+ });
+ }
+ });
+ }
});
function render_calendar() {
diff --git a/themes/lhs/layouts/shortcodes/printers.html b/themes/lhs/layouts/shortcodes/printers.html
new file mode 100644
index 0000000..f92b581
--- /dev/null
+++ b/themes/lhs/layouts/shortcodes/printers.html
@@ -0,0 +1,9 @@
+
+
+