Menu
Public repository / 9f0fd7a16e2dff7518389ff0ddbd603ebc6264ed
AkurAI-Notes / site/frontend/app.js
Latest change d1c548364d6b02de7558efdb50f0cd0cc5a2308e - E02: Landing page + GPT-5.5 icons + page.json + routes.json by Claude Code
(function () {
"use strict";
function init() {
const el = document.getElementById("health");
if (el) {
fetch("/api/health", { headers: { accept: "application/json" } })
.then((r) => (r.ok ? r.json() : Promise.reject(new Error(`status ${r.status}`))))
.then((d) => {
el.textContent = `server up ยท ${d.framework} ${d.version}`;
el.classList.add("ok");
})
.catch((e) => (el.textContent = `server unreachable: ${e.message}`));
}
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();
(function copyInit() {
"use strict";
function fallbackCopy(text) {
var ta = document.createElement("textarea");
ta.value = text;
ta.setAttribute("readonly", "");
ta.style.position = "absolute";
ta.style.left = "-9999px";
document.body.appendChild(ta);
ta.select();
var ok = false;
try {
ok = document.execCommand("copy");
} catch (e) {
ok = false;
}
document.body.removeChild(ta);
return ok;
}
function flash(btn) {
if (btn.dataset.copyBusy === "1") return;
btn.dataset.copyBusy = "1";
var original = btn.textContent;
btn.textContent = "Copied!";
btn.classList.add("is-copied");
setTimeout(function () {
btn.textContent = original;
btn.classList.remove("is-copied");
delete btn.dataset.copyBusy;
}, 1500);
}
function bind(widget) {
var btn = widget.querySelector("[data-copy-btn]");
if (!btn) return;
btn.addEventListener("click", function () {
var text = widget.getAttribute("data-clipboard") || "";
if (!text) return;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(
function () { flash(btn); },
function () { if (fallbackCopy(text)) flash(btn); }
);
} else if (fallbackCopy(text)) {
flash(btn);
}
});
}
function copyStart() {
document.querySelectorAll("[data-clipboard]").forEach(bind);
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", copyStart);
} else {
copyStart();
}
})();