mailymaily/dist/mailgo.js
2019-05-03 11:54:34 +02:00

1 line
1.2 KiB
JavaScript

let mailgos=document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)'),styles="\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-background {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: black;\n }\n .mailgo-modal.is-active {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .mailgo-modal-content {\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,t)=>{let n=document.createElement("div");n.className="mailgo-modal",n.id="mailgo-modal-"+t;let l=document.createElement("div");l.className="mailgo-modal-background",n.appendChild(l);let o=document.createElement("div");o.className="mailgo-modal-content",n.appendChild(o);let a=document.createTextNode("mailgo");o.appendChild(a),e.parentNode.insertBefore(n,e.nextSibling),e.addEventListener("click",t=>{t.preventDefault(),e.nextElementSibling.classList.add("is-active")},!1)});