mailymaily/dist/mailgo.min.js

2 lines
16 KiB
JavaScript

window.mailgo=function(e){var t={};function a(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=e,a.c=t,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=4)}([function(e){e.exports=JSON.parse('{"languages":["en","it","es"],"translations":{"en":{"open_in":"open in ","cc_":"cc ","bcc_":"bcc ","subject_":"subject ","body_":"body ","gmail":"Gmail","outlook":"Outlook","telegram":"Telegram","whatsapp":"WhatsApp","skype":"Skype","call":"call","open":"open","_default":" default","_as_default":" as default","copy":"copy"},"it":{"open_in":"apri con ","cc_":"cc ","bcc_":"ccn ","subject_":"oggetto ","body_":"testo ","gmail":"Gmail","outlook":"Outlook","telegram":"Telegram","whatsapp":"WhatsApp","skype":"Skype","call":"chiama","open":"apri","_default":" ","_as_default":" ","copy":"copia"},"es":{"open_in":"abrir con ","cc_":"cc ","bcc_":"cco ","subject_":"asunto ","body_":"cuerpo ","gmail":"Gmail","outlook":"Outlook","telegram":"Telegram","whatsapp":"WhatsApp","skype":"Skype","call":"llamar","open":"abrir","_default":" predefinido","_as_default":" por defecto","copy":"copiar"}}}')},function(e,t,a){var o=a(2);e.exports="string"==typeof o?o:o.toString()},function(e,t,a){(t=a(3)(!1)).push([e.i,'.m-modal{position:fixed;top:0;right:0;bottom:0;left:0;justify-content:center;align-items:center;flex-direction:column;overflow:hidden;font-size:15px;z-index:10000}.m-modal p,.m-modal span,.m-modal strong,.m-modal a{margin:0;padding:0;font-size:100%;line-height:1;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";text-rendering:optimizeLegibility}.m-modal strong{font-weight:700}.m-modal .m-modal-back{position:absolute;z-index:10001;top:0;right:0;bottom:0;left:0;background-color:#20232a;opacity:0.8}.m-modal .m-modal-content{position:relative;z-index:10002;box-sizing:content-box;text-align:center;min-width:200px;max-width:240px;background-color:#fff;opacity:0.95;border-radius:20px;box-shadow:0 3px 20px rgba(32,35,42,0.5);color:#4a4a4a;display:flex;flex-direction:column;overflow:auto;padding:24px;transition:0.5s box-shadow}.m-modal .m-modal-content:hover{opacity:1}.m-modal .m-modal-content .m-title{margin-bottom:8px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;line-height:1.2em}.m-modal .m-modal-content .m-details{margin-bottom:10px}.m-modal .m-modal-content .m-details p{font-size:12px;margin-top:3px;margin-bottom:3px}.m-modal .m-modal-content a{padding:10px;color:#4a4a4a;border-radius:20px;text-decoration:none}.m-modal .m-modal-content a.m-gmail{color:#d44638}.m-modal .m-modal-content a.m-gmail:hover{background-color:rgba(212,70,56,0.08);color:#d44638}.m-modal .m-modal-content a.m-outlook{color:#0072c6}.m-modal .m-modal-content a.m-outlook:hover{background-color:rgba(0,114,198,0.08);color:#0072c6}.m-modal .m-modal-content a.m-tg{color:#08c}.m-modal .m-modal-content a.m-tg:hover{background-color:rgba(0,136,204,0.08);color:#08c}.m-modal .m-modal-content a.m-wa{color:#00bfa5}.m-modal .m-modal-content a.m-wa:hover{background-color:rgba(0,191,165,0.08);color:#00bfa5}.m-modal .m-modal-content a.m-skype{color:#00aff0}.m-modal .m-modal-content a.m-skype:hover{background-color:rgba(0,175,240,0.08);color:#00aff0}.m-modal .m-modal-content a.m-copy{padding:16px 10px;font-size:16px}.m-modal .m-modal-content a.m-default:hover,.m-modal .m-modal-content a.m-copy:hover{background-color:rgba(0,0,0,0.08);color:#4a4a4a}.m-modal .m-modal-content a.m-by{font-size:9px;margin-top:0.8rem;padding:5px;color:#4a4a4a;opacity:0.55}.m-modal .m-modal-content a.m-by:hover{opacity:1}.m-modal .m-modal-content .w-500{font-weight:500}.m-modal.m-dark .m-modal-content{color:#fff;background-color:#20232a}.m-modal.m-dark .m-modal-content a{color:#bbb}.m-modal.m-dark .m-modal-content a:hover{color:#fff}.m-modal.m-dark .m-modal-content a.m-gmail:hover{color:#faeceb}.m-modal.m-dark .m-modal-content a.m-outlook:hover{color:#e5f0f9}.m-modal.m-dark .m-modal-content a.m-tg:hover{color:#e5f3f9}.m-modal.m-dark .m-modal-content a.m-wa:hover{color:#e5f8f6}.m-modal.m-dark .m-modal-content a.m-skype:hover{color:#e5f7fd}\n',""]),e.exports=t},function(e,t,a){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var a=function(e,t){var a=e[1]||"",o=e[3];if(!o)return a;if(t&&"function"==typeof btoa){var n=(l=o,d=btoa(unescape(encodeURIComponent(JSON.stringify(l)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(d),"/*# ".concat(c," */")),i=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[a].concat(i).concat([n]).join("\n")}var l,d,c;return[a].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(a,"}"):a})).join("")},t.i=function(e,a,o){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(o)for(var i=0;i<this.length;i++){var l=this[i][0];null!=l&&(n[l]=!0)}for(var d=0;d<e.length;d++){var c=[].concat(e[d]);o&&n[c[0]]||(a&&(c[2]?c[2]="".concat(a," and ").concat(c[2]):c[2]=a),t.push(c))}},t}},function(e,t,a){"use strict";a.r(t);var o,n,i,l,d,c,r,m,s,p,u,f,h,g,b,v,y,k,C,w,L=a(0),_=a.t(L,2),x=a(1).toString(),j="mailto:",A="tel:",E="callto:",N="javascript:void(0);",S="en",R="",U="",I="",M="",O="",T="",z="",W="",P="",H=function(e){var t,a;o=e;var x=_.translations;if((null===(t=o)||void 0===t?void 0:t.lang)&&L.languages.includes(o.lang)&&(S=o.lang),!(null===(a=o)||void 0===a?void 0:a.forceLang)){var j=document.documentElement.lang;L.languages.includes(j)&&(S=document.documentElement.lang)}var A,E=x.en,R=x[S],U=oe();U.style.display="none",U.id="mailgo",U.classList.add("m-modal"),(null===(A=o)||void 0===A?void 0:A.dark)&&U.classList.add("m-dark");var I=oe();I.className="m-modal-back",U.appendChild(I);var M=oe();M.className="m-modal-content",U.appendChild(M),(n=oe("strong")).id="m-title",n.className="m-title",M.appendChild(n);var O=oe();O.id="m-details",O.className="m-details",(l=oe("p")).id="m-cc";var T=oe("span");T.className="w-500",T.appendChild(ne(R.cc_||E.cc_)),(m=oe("span")).id="m-cc-value",l.appendChild(T),l.appendChild(m),O.appendChild(l),(d=oe("p")).id="m-bcc";var z=oe("span");z.className="w-500",z.appendChild(ne(R.bcc_||E.bcc_)),(s=oe("span")).id="m-bcc-value",d.appendChild(z),d.appendChild(s),O.appendChild(d),(c=oe("p")).id="m-subject";var W=oe("span");W.className="w-500",W.appendChild(ne(R.subject_||E.subject_)),(p=oe("span")).id="m-subject-value",c.appendChild(W),c.appendChild(p),O.appendChild(c),(r=oe("p")).id="m-body";var P=oe("span");P.className="w-500",P.appendChild(ne(R.body_||E.body_)),(u=oe("span")).id="m-body-value",r.appendChild(P),r.appendChild(u),O.appendChild(r),M.appendChild(O),(f=oe("a")).id="m-gmail",f.href=N,f.classList.add("m-open"),f.classList.add("m-gmail"),f.appendChild(ne(R.open_in||E.open_in));var H=oe("span");H.className="w-500",H.appendChild(ne(R.gmail||E.gmail)),f.appendChild(H),M.appendChild(f),(h=oe("a")).id="m-outlook",h.href=N,h.classList.add("m-open"),h.classList.add("m-outlook"),h.appendChild(ne(R.open_in||E.open_in));var D=oe("span");D.className="w-500",D.appendChild(ne(R.outlook||E.outlook)),h.appendChild(D),M.appendChild(h),(g=oe("a")).id="m-open",g.href=N,g.classList.add("m-open"),g.classList.add("m-default");var G=oe("span");G.className="w-500",G.appendChild(ne(R.open||E.open)),g.appendChild(G),g.appendChild(ne(R._default||E._default)),M.appendChild(g),(C=oe("a")).id="m-copy",C.href=N,C.classList.add("m-copy"),C.classList.add("w-500"),C.appendChild(ne(R.copy||E.copy)),M.appendChild(C),M.appendChild(ae()),document.body.appendChild(U),I.addEventListener("click",ee);var B,J=oe();J.style.display="none",J.id="mailgo-tel",J.classList.add("m-modal"),(null===(B=o)||void 0===B?void 0:B.dark)&&J.classList.add("m-dark");var Z=oe();Z.className="m-modal-back",J.appendChild(Z);var F=oe();F.className="m-modal-content",J.appendChild(F),(i=oe("strong")).id="m-tel-title",i.className="m-title",F.appendChild(i),(b=oe("a")).id="m-tg",b.href=N,b.classList.add("m-open"),b.classList.add("m-tg"),b.style.display="none",b.appendChild(ne(R.open_in||E.open_in));var $=oe("span");$.className="w-500",$.appendChild(ne(R.telegram||E.telegram)),b.appendChild($),F.appendChild(b),(v=oe("a")).id="m-wa",v.href=N,v.classList.add("m-open"),v.classList.add("m-wa"),v.appendChild(ne(R.open_in||E.open_in));var q=oe("span");q.className="w-500",q.appendChild(ne(R.whatsapp||E.whatsapp)),v.appendChild(q),F.appendChild(v),(y=oe("a")).id="m-skype",y.href=N,y.classList.add("m-open"),y.classList.add("m-skype"),y.appendChild(ne(R.open_in||E.open_in));var K=oe("span");K.className="w-500",K.appendChild(ne(R.skype||E.skype)),y.appendChild(K),F.appendChild(y),(k=oe("a")).id="m-call",k.href=N,k.classList.add("m-open"),k.classList.add("m-default");var Q=oe("span");Q.className="w-500",Q.appendChild(ne(R.call||E.call)),k.appendChild(Q),k.appendChild(ne(R._as_default||E._as_default)),F.appendChild(k),(w=oe("a")).id="m-tel-copy",w.href=N,w.classList.add("m-copy"),w.classList.add("w-500"),w.appendChild(ne(R.copy||E.copy)),F.appendChild(w),F.appendChild(ae()),document.body.appendChild(J),Z.addEventListener("click",ee),document.addEventListener("click",V)},D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"mail",t=arguments.length>1?arguments[1]:void 0;if("mail"===e){var a,L;if(t.href&&t.href.toLowerCase().startsWith(j)){R=decodeURIComponent(t.href.split("?")[0].split(j)[1].trim());var _=new URL(t.href).searchParams;I=_.get("cc"),M=_.get("bcc"),O=_.get("subject"),T=_.get("body")}else R=t.getAttribute("data-address")+"@"+t.getAttribute("data-domain"),new URL(j+encodeURIComponent(R)),I=t.getAttribute("data-cc-address")+"@"+t.getAttribute("data-cc-domain"),M=t.getAttribute("data-bcc-address")+"@"+t.getAttribute("data-bcc-domain"),O=t.getAttribute("data-subject"),T=t.getAttribute("data-body");if(void 0===(null===(a=o)||void 0===a?void 0:a.validateEmail)||!0===(null===(L=o)||void 0===L?void 0:L.validateEmail)){if(!pe(R.split(",")))return;I&&!pe(I.split(","))&&(I=""),M&&!pe(M.split(","))&&(M="")}n.innerHTML=R.split(",").join("<br/>"),I?(l.style.display="block",m.innerHTML=I.split(",").join("<br/>")):l.style.display="none",M?(d.style.display="block",s.innerHTML=M.split(",").join("<br/>")):d.style.display="none",O?(c.style.display="block",p.textContent=O):c.style.display="none",T?(r.style.display="block",u.textContent=T):r.style.display="none",f.addEventListener("click",G),h.addEventListener("click",B),U=le(R),g.addEventListener("click",J),C.addEventListener("click",(function(){return K(R)}))}if("tel"===e){if(t.href&&t.href.toLowerCase().startsWith(A)?z=decodeURIComponent(t.href.split("?")[0].split(A)[1].trim()):t.href&&t.href.toLowerCase().startsWith(E)?z=decodeURIComponent(t.href.split("?")[0].split(E)[1].trim()):t.hasAttribute("data-tel")&&(z=t.getAttribute("data-tel"),t.getAttribute("data-msg")),!ue(z))return;t.hasAttribute("data-telegram")&&(W=t.getAttribute("data-telegram")),t.hasAttribute("data-skype")&&(P=t.getAttribute("data-skype")),i.innerHTML=z,v.addEventListener("click",$),W&&(re("m-tg","block"),b.addEventListener("click",Z)),y.addEventListener("click",F),k.addEventListener("click",q),w.addEventListener("click",(function(){return K(z)}))}Y(e),document.addEventListener("keydown",X)},G=function(){var e="https://mail.google.com/mail/u/0/?view=cm&source=mailto&to="+encodeURIComponent(R);I&&(e=e.concat("&cc="+encodeURIComponent(I))),M&&(e=e.concat("&bcc="+encodeURIComponent(M))),O&&(e=e.concat("&subject="+O)),T&&(e=e.concat("&body="+T)),window.open(e,"_blank"),ee()},B=function(){var e="https://outlook.live.com/owa/?path=/mail/action/compose&to="+encodeURIComponent(R);O&&(e=e.concat("&subject="+O)),T&&(e=e.concat("&body="+T)),window.open(e,"_blank"),ee()},J=function(){ie(U),ee()},Z=function(){var e="https://t.me/"+W;window.open(e,"_blank"),ee()},F=function(){var e="skype:"+(""!==P?P:z);window.open(e,"_blank"),ee()},$=function(){var e="https://wa.me/"+z;window.open(e,"_blank"),ee()},q=function(){var e="tel:"+z;window.open(e),ee()},K=function(e){var t;fe(e),(t=te("mail")?C:w).textContent="copied",setTimeout((function(){t.textContent="copy",ee()}),999)},Q=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"mail",a=e.href;return"mail"===t?a&&a.toLowerCase().startsWith(j)&&!e.classList.contains("no-mailgo")||e.hasAttribute("data-address")&&(a&&"#mailgo"===e.getAttribute("href").toLowerCase()||e.classList&&e.classList.contains("mailgo")):"tel"===t&&(a&&(a.toLowerCase().startsWith(A)||a.toLowerCase().startsWith(E))&&!e.classList.contains("no-mailgo")||e.hasAttribute("data-tel")&&a&&"#mailgo"===e.getAttribute("href").toLowerCase()||e.classList&&e.classList.contains("mailgo"))},V=function(e){if(!document.contains(de("mailgo"))||!document.contains(de("mailgo-tel")))return!1;if(te("mail")||te("tel"))return!1;var t=e.composedPath&&e.composedPath()||me(e.target);return t&&t.forEach((function(t){return!(t instanceof HTMLDocument||t instanceof Window)&&(Q(t,"mail")?(e.preventDefault(),D("mail",t),!0):Q(t,"tel")?(e.preventDefault(),D("tel",t),!0):void 0)})),!1},X=function(e){if(te("mail"))switch(e.keyCode){case 27:ee();break;case 71:G();break;case 79:B();break;case 32:case 13:J();break;case 67:K(R);break;default:return}else if(te("tel"))switch(e.keyCode){case 27:ee();break;case 84:Z();break;case 87:$();break;case 32:case 13:q();break;case 67:K(z);break;default:return}},Y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"mail";return"mail"===e?(re("mailgo","flex"),!0):"tel"===e&&(re("mailgo-tel","flex"),!0)},ee=function(){re("mailgo","none"),re("mailgo-tel","none"),document.removeEventListener("keydown",X)},te=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"mail";return"mail"===e?"flex"===ce("mailgo"):"tel"===e&&"flex"===ce("mailgo-tel")},ae=function(){var e=oe("a");return e.href="https://mailgo.dev?ref=mailgo-modal",e.className="m-by",e.target="_blank",e.rel="noopener noreferrer",e.appendChild(ne("mailgo.dev")),e},oe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div";return document.createElement(e)},ne=function(e){return document.createTextNode(e)},ie=function(e){return window.location.href=j+atob(e)},le=function(e){return btoa(e)},de=function(e){return document.getElementById(e)},ce=function(e){return de(e).style.display},re=function(e,t){return de(e).style.display=t},me=function(e){for(var t=[];e;){if(t.push(e),"HTML"===e.tagName)return t.push(document),t.push(window),t;e=e.parentElement}},se=function(e){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},pe=function(e){return e.every(se)},ue=function(e){return!0},fe=function(e){var t=oe("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t);var a=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);return t.select(),document.execCommand("copy"),document.body.removeChild(t),!!a&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(a),!0)};(function(e){var t;window&&"undefined"!=typeof window&&((t=oe("style")).id="mailgo-style",t.type="text/css",t.appendChild(ne(x)),document.head.appendChild(t),(null==e?void 0:e.initEvent)?document.addEventListener(e.initEvent,(function(){H(e)})):H(e))})({initEvent:"DOMContentLoaded"})}]);
//# sourceMappingURL=mailgo.min.js.map