// ── Error modal ─────────────────────────────────────────────────────────────── // // A simple overlay modal that displays -ACK! with a custom message. // Depends on: dom.js ($) // /** * Shows the error modal with the given message. * The overlay is absolutely positioned and blocks all interaction until dismissed. * @param {string} msg - message to display inside the error box */ function showError(msg) { const el = $("#error-overlay"); if (!el) { console.error("ACK: " + msg); return; } const msgEl = el.querySelector(".error-msg"); if (msgEl) msgEl.textContent = msg; el.classList.add("active"); } /** * Hides the error modal. Triggered by clicking the × button, * the overlay backdrop, or called programmatically. * @param {MouseEvent} [ev] - event to check target matching */ function closeError(ev) { const el = $("#error-overlay"); if (!el) return; if ( !ev || ev.target === ev.currentTarget || ev.target.classList.contains("error-close") ) { el.classList.remove("active"); } }