Training-Support-Icons Training-Support-Icons Training-Support-Icons Training-Support-Icons skip to Main Content
`; const body = document.createElement("div"); body.style.padding = "16px 20px"; body.style.fontSize = "15px"; body.style.lineHeight = "1.5"; body.innerHTML = MESSAGE; const footer = document.createElement("div"); footer.style.padding = "14px 20px"; footer.style.borderTop = "1px solid rgba(0,0,0,0.08)"; footer.style.display = "flex"; footer.style.justifyContent = "flex-end"; const btn = document.createElement("button"); btn.type = "button"; btn.textContent = ACK_TEXT; btn.style.padding = "10px 14px"; btn.style.border = "0"; btn.style.borderRadius = "10px"; btn.style.cursor = "pointer"; btn.style.fontWeight = "600"; btn.style.background = "#111"; btn.style.color = "#fff"; btn.addEventListener("click", function () { storeAck(); overlay.remove(); // Return focus to the page try { document.body.focus(); } catch {} }); footer.appendChild(btn); card.appendChild(header); card.appendChild(body); card.appendChild(footer); overlay.appendChild(card); // Prevent scrolling behind the modal const originalOverflow = document.body.style.overflow; document.body.style.overflow = "hidden"; // Restore scroll when modal closes const observer = new MutationObserver(() => { if (!document.body.contains(overlay)) { document.body.style.overflow = originalOverflow; observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); document.body.appendChild(overlay); btn.focus(); } // Run on DOM ready function init() { if (!hasValidAck()) showModal(); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); } })();
Back To Top