mailymaily/dist/mailgo.min.js
2019-05-03 12:26:06 +02:00

1 line
1.3 KiB
JavaScript

let mailgos=document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)'),styles="\n .mailgo-modal-background {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: black;\n opacity: 0.8;\n }\n .mailgo-modal {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n }\n .mailgo-modal.is-active {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .mailgo-modal-content {\n z-index: 1000;\n border-radius: 8px;\n background: white;\n padding: 24px;\n margin: 24px;\n }\n",styleSheet=document.createElement("style");styleSheet.type="text/css",styleSheet.innerText=styles,document.head.appendChild(styleSheet),console.log("mailgo is WIP!"),mailgos.forEach((e,n)=>{let t=document.createElement("div");t.className="mailgo-modal",t.id="mailgo-modal-"+n;let l=document.createElement("div");l.className="mailgo-modal-background",t.appendChild(l);let o=document.createElement("div");o.className="mailgo-modal-content",t.appendChild(o);let a=document.createTextNode("mailgo");o.appendChild(a),e.parentNode.insertBefore(t,e.nextSibling),e.addEventListener("click",n=>{n.preventDefault(),e.nextElementSibling.classList.add("is-active")},!1)});