(function () {
"use strict";
function applyOne(el) {
var spec = el.getAttribute("data-sx-style");
if (!spec) return;
var decls = spec.split(";");
for (var i = 0; i < decls.length; i++) {
var d = decls[i];
if (!d) continue;
var c = d.indexOf(":");
if (c < 0) continue;
var prop = d.slice(0, c).trim();
var val = d.slice(c + 1).trim();
if (prop) el.style.setProperty(prop, val);
}
el.removeAttribute("data-sx-style");
}
function apply(root) {
if (!root) root = document;
if (root.nodeType === 1 && root.hasAttribute("data-sx-style")) applyOne(root);
var list = root.querySelectorAll ? root.querySelectorAll("[data-sx-style]") : [];
for (var i = 0; i < list.length; i++) applyOne(list[i]);
}
window.sxApply = apply;
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function () { apply(document); });
} else {
apply(document);
}
window.__sxCss = "";
try {
fetch("/static/app.css").then(function (r) { return r.text(); })
.then(function (t) { window.__sxCss = t; }).catch(function () {});
} catch (e) { }
window.sxSelfContain = function (html) {
if (!window.__sxCss) return html;
return html.replace(
/<link\b[^>]*href="\/static\/app\.css"[^>]*>/,
"<style>" + window.__sxCss + "</style>"
);
};
if (typeof MutationObserver === "function") {
new MutationObserver(function (muts) {
for (var i = 0; i < muts.length; i++) {
var added = muts[i].addedNodes;
for (var j = 0; j < added.length; j++) {
if (added[j].nodeType === 1) apply(added[j]);
}
}
}).observe(document.documentElement, { childList: true, subtree: true });
}
})();
(function () {
"use strict";
function plainText(a) {
if (!a || !a.parentNode) return;
var span = document.createElement("span");
span.textContent = a.textContent;
a.parentNode.replaceChild(span, a);
}
function normalizeFooters(info) {
if (!info || !info.offline) return;
document.body.classList.add("sloc-offline");
var repo = info.repo_reachable && info.repo_url ? info.repo_url : "";
var links = document.querySelectorAll(".site-footer a");
for (var i = 0; i < links.length; i++) {
var a = links[i];
var href = a.getAttribute("href") || "";
if (!href || href.charAt(0) === "/") continue; var isViewRepo =
/^https?:\/\/(www\.)?github\.com\/oxide-sloc(\/|$)/i.test(href) ||
/view on github/i.test(a.textContent || "");
if (isViewRepo) {
if (repo) {
a.setAttribute("href", repo);
a.setAttribute("title", "Repository this build came from");
a.textContent = "View repository";
} else {
plainText(a);
}
continue;
}
plainText(a);
}
addAirgapBadge();
}
function addAirgapBadge() {
var wrap = document.getElementById("server-status-wrap");
if (!wrap || !wrap.parentNode || document.getElementById("airgap-pill")) return;
var pill = document.createElement("span");
pill.id = "airgap-pill";
pill.className = "nav-pill"; pill.textContent = "Air-gapped";
pill.setAttribute(
"title",
"No internet access for this deployment — external links are disabled"
);
wrap.parentNode.insertBefore(pill, wrap);
}
function run(info) {
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", function () { normalizeFooters(info); });
} else {
normalizeFooters(info);
}
}
try {
fetch("/api/connectivity", { cache: "no-store" })
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (info) { run(info); })
.catch(function () { });
} catch (e) { }
})();