1/* Public Better Stack status feed; used by the static homepage and routed pages. */ 2(function () { 3 if (window.__picoStatusReady) return; 4 window.__picoStatusReady = true; 5 6 var status = "unknown"; 7 var labels = { 8 operational: "operationeel", 9 degraded: "verminderde beschikbaarheid", 10 outage: "storing", 11 unknown: "status niet beschikbaar" 12 }; 13 14 function displayStatus() { 15 document.querySelectorAll(".pico-status-link").forEach(function (link) { 16 if (link.getAttribute("data-status") === status) return; 17 link.setAttribute("data-status", status); 18 link.setAttribute("aria-label", "Status Pico â " + labels[status]); 19 link.setAttribute("title", labels[status]); 20 }); 21 } 22 23 function mapStatus(value) { 24 if (value === "operational") return "operational"; 25 if (["degraded_performance", "degraded", "partial_outage", "under_maintenance", "maintenance"].indexOf(value) !== -1) return "degraded"; 26 if (["major_outage", "downtime", "outage"].indexOf(value) !== -1) return "outage"; 27 return "unknown"; 28 } 29 30 function refresh() { 31 fetch("https://status.homezero.tech/index.json", { cache: "no-store" }) 32 .then(function (response) { 33 if (!response.ok) throw new Error("Status request failed"); 34 return response.json(); 35 }) 36 .then(function (payload) { 37 var resources = Array.isArray(payload.included) ? payload.included : []; 38 var pico = resources.find(function (item) { 39 return item.type === "status_page_resource" && item.attributes && item.attributes.public_name === "Pico"; 40 }); 41 var value = pico && pico.attributes.status; 42 status = mapStatus(value || (payload.data && payload.data.attributes && payload.data.attributes.aggregate_state)); 43 displayStatus(); 44 }) 45 .catch(function () { 46 status = "unknown"; 47 displayStatus(); 48 }); 49 } 50 51 function start() { 52 displayStatus(); 53 refresh(); 54 setInterval(refresh, 60000); 55 // Routed pages replace their footer without a full document load. 56 new MutationObserver(function (changes) { 57 if (changes.some(function (change) { 58 return Array.prototype.some.call(change.addedNodes, function (node) { 59 return node.nodeType === 1 && (node.matches?.(".pico-status-link") || node.querySelector?.(".pico-status-link")); 60 }); 61 })) displayStatus(); 62 }).observe(document.body, { childList: true, subtree: true }); 63 } 64 65 if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start, { once: true }); 66 else start(); 67})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.