Repository navigation
Expand file tree
/
Copy pathmodalify-min.js
More file actions
1 lines (1 loc) · 3.03 KB
/
Copy pathmodalify-min.js
File metadata and controls
1 lines (1 loc) · 3.03 KB
1
!function(){const n=document.createElement("style");n.type="text/css",n.innerText="\n /* Modal Styles */\n body.modal-open { overflow: hidden; }\n\n .modal-overlay {\n position: fixed;\n top: 0; left: 0;\n width: 100%; height: 100%;\n background: rgba(0, 0, 0, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n }\n\n .modal-container {\n background: #DBDDDF;\n border-radius: 14px;\n width: 90%; max-width: 400px;\n text-align: center;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);\n overflow: hidden;\n font-family: inherit; /* Inherit font from the overlay */\n }\n\n .modal-header-bar {\n height: 4px; width: 100%;\n }\n\n .modal-title {\n font-size: 1.6em;\n margin: 25px 0 5px;\n font-weight: 700;\n }\n\n .modal-description {\n font-size: 1.1em;\n margin: 0 20px 25px;\n color: #6C7075;\n font-weight: 500;\n }\n\n .modal-actions {\n display: flex;\n flex-direction: column;\n }\n\n .modal-button {\n width: 100%;\n padding: 17px 0;\n font-size: 1.1em;\n font-weight: 700;\n text-align: center;\n border: none;\n border-top: 2px solid #B4B9BE;\n color: #2E72D2;\n background: transparent;\n cursor: pointer;\n transition: background 0.3s ease;\n }\n\n .modal-button:hover {\n background: #E7E8EA;\n } \n\n /* Alert Types */\n .alert-default .modal-header-bar { background: #2C6FCD; }\n .alert-default .modal-title { color: #202223; }\n\n .alert-alert .modal-header-bar { background: #B98900; }\n .alert-alert .modal-title { color: #916A00; }\n\n .alert-error .modal-header-bar { background: #D92800; }\n .alert-error .modal-title { color: #D92B0D; }\n ",document.head.appendChild(n),window.showModalAlert=function({type:n,headline:e,description:t,actions:o,dismissible:a=!1}){const d=document.querySelector(".modal-overlay");d&&d.remove();const l=document.createElement("div");l.className="modal-overlay",document.body.classList.add("modal-open"),a&&l.addEventListener("click",(n=>{n.target===l&&p()}));const r=document.createElement("div");r.className=`modal-container alert-${n}`;const i=document.createElement("div");i.className="modal-header-bar";const c=document.createElement("div");c.className="modal-title",c.textContent=e;const m=document.createElement("div");m.className="modal-description",m.textContent=t;const s=document.createElement("div");function p(){document.body.classList.remove("modal-open"),l.remove()}s.className="modal-actions",o.forEach((n=>{const e=document.createElement("div");e.textContent=n.label,e.className="modal-button",e.onclick=()=>{n.handler(n.label),p()},s.appendChild(e)})),r.appendChild(i),r.appendChild(c),r.appendChild(m),r.appendChild(s),l.appendChild(r),document.body.appendChild(l)}}();