mailymaily/dist/mailgo.min.js
2020-04-24 18:01:25 +02:00

1 line
13 KiB
JavaScript

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var mailgoVersion="0.9.0",mailgo=function(){function t(){var e=ee();e.style.display="none",e.id="mailgo",e.classList.add("m-modal");var t=ee();t.className="m-modal-back",e.appendChild(t);var a=ee();a.className="m-modal-content",e.appendChild(a),(w=ee("strong")).id="m-title",w.className="m-title",a.appendChild(w);var o=ee();o.id="m-details",o.className="m-details",(v=ee("p")).id="m-cc";var n=ee(H);n.className="w-500",n.appendChild(te("cc ")),(L=ee(H)).id="m-cc-value",v.appendChild(n),v.appendChild(L),o.appendChild(v),(y=ee("p")).id="m-bcc";var i=ee(H);i.className="w-500",i.appendChild(te("bcc ")),(z=ee(H)).id="m-bcc-value",y.appendChild(i),y.appendChild(z),o.appendChild(y),(C=ee("p")).id="m-subject";var d=ee(H);d.className="w-500",d.appendChild(te("subject ")),(A=ee(H)).id="m-subject-value",C.appendChild(d),C.appendChild(A),o.appendChild(C),(k=ee("p")).id="m-body";var l=ee(H);l.className="w-500",l.appendChild(te("body ")),(E=ee(H)).id="m-body-value",k.appendChild(l),k.appendChild(E),o.appendChild(k),a.appendChild(o),(N=ee("a")).id="m-gmail",N.href=W,N.classList.add("m-open"),N.classList.add("m-gmail"),N.appendChild(te("open in "));var s=ee(H);s.className="w-500",s.appendChild(te("Gmail")),N.appendChild(s),a.appendChild(N),(j=ee("a")).id="m-outlook",j.href=W,j.classList.add("m-open"),j.classList.add("m-outlook"),j.appendChild(te("open in "));var c=ee(H);c.className="w-500",c.appendChild(te("Outlook")),j.appendChild(c),a.appendChild(j),(R=ee("a")).id="m-open",R.href=W,R.classList.add("m-open"),R.classList.add("m-default");var r=ee(H);r.className="w-500",r.appendChild(te("open")),R.appendChild(r),R.appendChild(te(" default")),a.appendChild(R),(M=ee("a")).id="m-copy",M.href=W,M.classList.add("m-copy"),M.classList.add("w-500"),M.appendChild(te("copy")),a.appendChild(M),a.appendChild(Y()),document.body.appendChild(e),t.addEventListener("click",Q);var m=ee();m.style.display="none",m.id="mailgo-tel",m.classList.add("m-modal");var p=ee();p.className="m-modal-back",m.appendChild(p);var b=ee();b.className="m-modal-content",m.appendChild(b),(x=ee("strong")).id="m-tel-title",x.className="m-title",b.appendChild(x),(U=ee("a")).id="m-tg",U.href=W,U.classList.add("m-open"),U.classList.add("m-tg"),U.style.display="none",U.appendChild(te("open in "));var u=ee(H);u.className="w-500",u.appendChild(te("Telegram")),U.appendChild(u),b.appendChild(U),(I=ee("a")).id="m-wa",I.href=W,I.classList.add("m-open"),I.classList.add("m-wa"),I.appendChild(te("open in "));var h=ee(H);h.className="w-500",h.appendChild(te("WhatsApp")),I.appendChild(h),b.appendChild(I),(S=ee("a")).id="m-skype",S.href=W,S.classList.add("m-open"),S.classList.add("m-skype"),S.appendChild(te("open in "));var f=ee(H);f.className="w-500",f.appendChild(te("Skype")),S.appendChild(f),b.appendChild(S),(_=ee("a")).id="m-call",_.href=W,_.classList.add("m-open"),_.classList.add("m-default");var g=ee(H);g.className="w-500",g.appendChild(te("call")),_.appendChild(g),_.appendChild(te(" as default")),b.appendChild(_),(T=ee("a")).id="m-tel-copy",T.href=W,T.classList.add("m-copy"),T.classList.add("w-500"),T.appendChild(te("copy")),b.appendChild(T),b.appendChild(Y()),document.body.appendChild(m),p.addEventListener("click",Q)}function a(e,t){var a=0<arguments.length&&void 0!==e?e:c,o=1<arguments.length?t:void 0;if(a===c){if(o.href&&o.href.toLowerCase().startsWith(d)){m=decodeURIComponent(o.href.split("?")[0].split(d)[1].trim());var n=new URL(o.href).searchParams;b=n.get("cc"),u=n.get("bcc"),h=n.get("subject"),f=n.get("body")}else m=o.getAttribute("data-address")+"@"+o.getAttribute("data-domain"),new URL(d+encodeURIComponent(m)),b=o.getAttribute("data-cc-address")+"@"+o.getAttribute("data-cc-domain"),u=o.getAttribute("data-bcc-address")+"@"+o.getAttribute("data-bcc-domain"),h=o.getAttribute("data-subject"),f=o.getAttribute("data-body");if(!le(m.split(",")))return;b&&!le(b.split(","))&&(b=""),u&&!le(u.split(","))&&(u=""),w.innerHTML=m.split(",").join("<br/>"),b?(v.style.display="block",L.innerHTML=b.split(",").join("<br/>")):v.style.display="none",u?(y.style.display="block",z.innerHTML=u.split(",").join("<br/>")):y.style.display="none",h?(C.style.display="block",A.textContent=h):C.style.display="none",f?(k.style.display="block",E.textContent=f):k.style.display="none",N.addEventListener("click",O),j.addEventListener("click",B),p=ae(m),R.addEventListener("click",Z),M.addEventListener("click",function(){return q(m)})}a===r&&(o.href&&o.href.toLowerCase().startsWith(l)?g=decodeURIComponent(o.href.split("?")[0].split(l)[1].trim()):o.href&&o.href.toLowerCase().startsWith(s)?g=decodeURIComponent(o.href.split("?")[0].split(s)[1].trim()):o.hasAttribute("data-tel")&&(g=o.getAttribute("data-tel"),o.getAttribute("data-msg")),o.hasAttribute("data-telegram")&&(D=o.getAttribute("data-telegram")),o.hasAttribute("data-skype")&&(P=o.getAttribute("data-skype")),x.innerHTML=g,I.addEventListener("click",V),D&&(ie("m-tg","block"),U.addEventListener("click",F)),S.addEventListener("click",G),_.addEventListener("click",$),T.addEventListener("click",function(){return q(g)})),K(a),document.addEventListener("keydown",J)}function o(e,t){var a=1<arguments.length&&void 0!==t?t:c,o=e.href;return a===c?o&&o.toLowerCase().startsWith(d)&&!e.classList.contains("no-mailgo")||e.hasAttribute("data-address")&&(o&&"#mailgo"===e.getAttribute("href").toLowerCase()||e.classList&&e.classList.contains("mailgo")):a===r&&(o&&(o.toLowerCase().startsWith(l)||o.toLowerCase().startsWith(s))&&!e.classList.contains("no-mailgo")||e.hasAttribute("data-tel")&&o&&"#mailgo"===e.getAttribute("href").toLowerCase()||e.classList&&e.classList.contains("mailgo"))}function n(t){if(document.contains(oe("mailgo"))&&document.contains(oe("mailgo-tel"))&&!X(c)&&!X(r)){var e=t.composedPath&&t.composedPath()||de(t.target);e&&e.forEach(function(e){if(!(e instanceof HTMLDocument||e instanceof Window))return o(e,c)?(t.preventDefault(),void a(c,e)):o(e,r)?(t.preventDefault(),void a(r,e)):void 0})}}function i(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)}var w,x,v,y,C,k,L,z,A,E,N,j,R,U,I,S,_,M,T,d="mailto:",l="tel:",s="callto:",c="mail",r="tel",W="javascript:void(0);",H="span",m="",p="",b="",u="",h="",f="",g="",D="",P="",O=function(){var e="https://mail.google.com/mail/u/0/?view=cm&source=mailto&to="+encodeURIComponent(m);b&&(e=e.concat("&cc="+encodeURIComponent(b))),u&&(e=e.concat("&bcc="+encodeURIComponent(u))),h&&(e=e.concat("&subject="+h)),f&&(e=e.concat("&body="+f)),window.open(e,"_blank"),Q()},B=function(){var e="https://outlook.live.com/owa/?path=/mail/action/compose&to="+encodeURIComponent(m);h&&(e=e.concat("&subject="+h)),f&&(e=e.concat("&body="+f)),window.open(e,"_blank"),Q()},Z=function(){e(p),Q()},F=function(){var e="https://t.me/"+D;window.open(e,"_blank"),Q()},G=function(){var e="skype:"+(""!==P?P:g);window.open(e,"_blank"),Q()},V=function(){var e="https://wa.me/"+g;window.open(e,"_blank"),Q()},$=function(){var e="tel:"+g;window.open(e),Q()},q=function(e){var t;se(e),(t=X(c)?M:T).textContent="copied",setTimeout(function(){t.textContent="copy",Q()},999)},J=function(e){if(X(c))switch(e.keyCode){case 27:Q();break;case 71:O();break;case 79:B();break;case 32:case 13:Z();break;case 67:q(m);break;default:return}else if(X(r))switch(e.keyCode){case 27:Q();break;case 84:F();break;case 87:V();break;case 32:case 13:$();break;case 67:q(g);break;default:return}},K=function(e){var t=0<arguments.length&&void 0!==e?e:c;t!==c?t!==r||ie("mailgo-tel","flex"):ie("mailgo","flex")},Q=function(){ie("mailgo","none"),ie("mailgo-tel","none"),document.removeEventListener("keydown",J)},X=function(e){var t=0<arguments.length&&void 0!==e?e:c;return t===c?"flex"===ne("mailgo"):t===r&&"flex"===ne("mailgo-tel")},Y=function(){var e=ee("a");return e.href="https://mailgo.js.org?ref=mailgo-modal",e.className="m-by",e.target="_blank",e.rel="noopener noreferrer",e.appendChild(te("mailgo.js.org")),e},ee=function(e){var t=0<arguments.length&&void 0!==e?e:"div";return document.createElement(t)},te=function(e){return document.createTextNode(e)},e=function(e){return window.location.href=d+atob(e)},ae=function(e){return btoa(e)},oe=function(e){return document.getElementById(e)},ne=function(e){return oe(e).style.display},ie=function(e,t){return oe(e).style.display=t},de=function(e){for(var t=[];e;){if(t.push(e),"HTML"===e.tagName)return t.push(document),t.push(window),t;e=e.parentElement}},le=function(e){return e.every(i)},se=function(e){var t=ee("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t);var a=0<document.getSelection().rangeCount&&document.getSelection().getRangeAt(0);t.select(),document.execCommand("copy"),document.body.removeChild(t),a&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(a))};!function(){if(window&&"undefined"!=typeof window){var e=ee("style");e.id="mailgo-style",e.type="text/css",e.appendChild(te('.m-modal{position:fixed;top:0;right:0;bottom:0;left:0;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;overflow:hidden;font-size:15px;z-index:10000}.m-modal a,.m-modal p,.m-modal span,.m-modal strong{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:rgba(32,35,42,.75);opacity:.8}.m-modal .m-modal-content{position:relative;z-index:10002;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;text-align:center;min-width:200px;max-width:240px;background-color:#fff;opacity:.97;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px;-webkit-box-shadow:0 3px 20px rgba(32,35,42,.5);-moz-box-shadow:0 3px 20px rgba(32,35,42,.5);box-shadow:0 3px 20px rgba(32,35,42,.5);color:#4a4a4a;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;overflow:auto;padding:20px;-webkit-transition:.5s -webkit-box-shadow;transition:.5s -webkit-box-shadow;-o-transition:.5s box-shadow;-moz-transition:.5s box-shadow,.5s -moz-box-shadow;transition:.5s box-shadow;transition:.5s box-shadow,.5s -webkit-box-shadow,.5s -moz-box-shadow}.m-modal .m-modal-content:hover{opacity:1;-webkit-box-shadow:0 7px 20px rgba(32,35,42,.85);-moz-box-shadow:0 7px 20px rgba(32,35,42,.85);box-shadow:0 7px 20px rgba(32,35,42,.85)}.m-modal .m-modal-content .m-title{margin-bottom:8px;overflow:hidden;white-space:nowrap;-o-text-overflow:ellipsis;text-overflow:ellipsis}.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;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px;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,.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,.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,114,198,.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,.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,.08);color:#00aff0}.m-modal .m-modal-content a.m-copy{padding:16px 10px;font-size:16px}.m-modal .m-modal-content a.m-copy:hover,.m-modal .m-modal-content a.m-default:hover{background-color:rgba(0,0,0,.08);color:#4a4a4a}.m-modal .m-modal-content a.m-by{font-size:8px;margin-top:.8rem;padding:5px;color:#4a4a4a;opacity:.5}.m-modal .m-modal-content a.m-by:hover{opacity:1}.m-modal .m-modal-content .w-500{font-weight:500}')),document.head.appendChild(e),document.addEventListener("DOMContentLoaded",t),document.addEventListener("click",n)}}()};window&&"undefined"!=typeof window&&mailgo();var _default=mailgo;exports.default=_default;