mailymaily/dist/mailgo.min.js

1 line
12 KiB
JavaScript

"use strict";var mailgoVersion="0.8.3";!function(){function e(){var t=Y("div");t.style.display="none",t.id="mailgo",t.classList.add("m-modal");var e=Y("div");e.className="m-modal-back",t.aC(e);var a=Y("div");a.className="m-modal-content",t.aC(a),(w=Y("strong")).id="m-title",w.className="m-title",a.aC(w);var o=Y("div");o.id="m-details",o.className="m-details",(x=Y("p")).id="m-cc";var n=Y("span");n.className="w-500",n.aC(et("cc ")),(L=Y("span")).id="m-cc-value",x.aC(n),x.aC(L),o.aC(x),(C=Y("p")).id="m-bcc";var i=Y("span");i.className="w-500",i.aC(et("bcc ")),(z=Y("span")).id="m-bcc-value",C.aC(i),C.aC(z),o.aC(C),(y=Y("p")).id="m-subject";var s=Y("span");s.className="w-500",s.aC(et("subject ")),(A=Y("span")).id="m-subject-value",y.aC(s),y.aC(A),o.aC(y),(k=Y("p")).id="m-body";var d=Y("span");d.className="w-500",d.aC(et("body ")),(E=Y("span")).id="m-body-value",k.aC(d),k.aC(E),o.aC(k),a.aC(o),(N=Y("a")).id="m-gmail",N.href=W,N.classList.add("m-open"),N.classList.add("m-gmail"),N.aC(et("open in "));var l=Y("span");l.className="w-500",l.aC(et("Gmail")),N.aC(l),a.aC(N),(j=Y("a")).id="m-outlook",j.href=W,j.classList.add("m-open"),j.classList.add("m-outlook"),j.aC(et("open in "));var c=Y("span");c.className="w-500",c.aC(et("Outlook")),j.aC(c),a.aC(j),(R=Y("a")).id="m-open",R.href=W,R.classList.add("m-open"),R.classList.add("m-default");var r=Y("span");r.className="w-500",r.aC(et("open")),R.aC(r),R.aC(et(" default")),a.aC(R),(M=Y("a")).id="m-copy",M.href=W,M.classList.add("m-copy"),M.classList.add("w-500"),M.aC(et("copy")),a.aC(M),a.aC(X()),document.body.aC(t),e.addEventListener("click",K);var m=Y("div");m.style.display="none",m.id="mailgo-tel",m.classList.add("m-modal");var p=Y("div");p.className="m-modal-back",m.aC(p);var b=Y("div");b.className="m-modal-content",m.aC(b),(h=Y("strong")).id="m-tel-title",h.className="m-title",b.aC(h),(U=Y("a")).id="m-tg",U.href=W,U.classList.add("m-open"),U.classList.add("m-tg"),U.style.display="none",U.aC(et("open in "));var u=Y("span");u.className="w-500",u.aC(et("Telegram")),U.aC(u),b.aC(U),(I=Y("a")).id="m-wa",I.href=W,I.classList.add("m-open"),I.classList.add("m-wa"),I.aC(et("open in "));var f=Y("span");f.className="w-500",f.aC(et("WhatsApp")),I.aC(f),b.aC(I),(S=Y("a")).id="m-skype",S.href=W,S.classList.add("m-open"),S.classList.add("m-skype"),S.aC(et("open in "));var g=Y("span");g.className="w-500",g.aC(et("Skype")),S.aC(g),b.aC(S),(T=Y("a")).id="m-call",T.href=W,T.classList.add("m-open"),T.classList.add("m-default");var v=Y("span");v.className="w-500",v.aC(et("call")),T.aC(v),T.aC(et(" as default")),b.aC(T),(H=Y("a")).id="m-tel-copy",H.href=W,H.classList.add("m-copy"),H.classList.add("w-500"),H.aC(et("copy")),b.aC(H),b.aC(X()),document.body.aC(m),p.addEventListener("click",K)}function a(t,e){var a=0<arguments.length&&void 0!==t?t:l,o=1<arguments.length?e:void 0;if(a===l){if(o.href&&o.href.toLowerCase().startsWith(i)){m=decodeURIComponent(o.href.split("?")[0].split(i)[1].trim()),r=new URL(o.href);var n=new URLSearchParams(r.search);b=n.get("cc"),u=n.get("bcc"),f=n.get("subject"),g=n.get("body")}else m=o.getAttribute("data-address")+"@"+o.getAttribute("data-domain"),r=new URL(i+encodeURIComponent(m)),b=o.getAttribute("data-cc-address")+"@"+o.getAttribute("data-cc-domain"),u=o.getAttribute("data-bcc-address")+"@"+o.getAttribute("data-bcc-domain"),f=o.getAttribute("data-subject"),g=o.getAttribute("data-body");if(!dt(m.split(",")))return;b&&!dt(b.split(","))&&(b=""),u&&!dt(u.split(","))&&(u=""),w.innerHTML=m.split(",").join("<br/>"),b?(x.style.display="block",L.innerHTML=b.split(",").join("<br/>")):x.style.display="none",u?(C.style.display="block",z.innerHTML=u.split(",").join("<br/>")):C.style.display="none",f?(y.style.display="block",A.textContent=f):y.style.display="none",g?(k.style.display="block",E.textContent=g):k.style.display="none",N.addEventListener("click",P),j.addEventListener("click",B),p=at(m),R.addEventListener("click",O),M.addEventListener("click",function(){return $(m)})}a===c&&(o.href&&o.href.toLowerCase().startsWith(s)?v=decodeURIComponent(o.href.split("?")[0].split(s)[1].trim()):o.href&&o.href.toLowerCase().startsWith(d)?v=decodeURIComponent(o.href.split("?")[0].split(d)[1].trim()):o.hasAttribute("data-tel")&&(v=o.getAttribute("data-tel"),o.getAttribute("data-msg")),o.hasAttribute("data-telegram")&&(_=o.getAttribute("data-telegram")),o.hasAttribute("data-skype")&&(D=o.getAttribute("data-skype")),h.innerHTML=v,I.addEventListener("click",G),_&&(it("m-tg","block"),U.addEventListener("click",Z)),S.addEventListener("click",F),T.addEventListener("click",V),H.addEventListener("click",function(){return $(v)})),J(a),document.addEventListener("keydown",q)}function o(t,e){var a=1<arguments.length&&void 0!==e?e:l;return a===l?t.href&&t.href.toLowerCase().startsWith(i)&&!t.classList.contains("no-mailgo")||t.hasAttribute("data-address")&&(t.href&&"#mailgo"===t.getAttribute("href").toLowerCase()||t.classList&&t.classList.contains("mailgo")):a===c&&(t.href&&(t.href.toLowerCase().startsWith(s)||t.href.toLowerCase().startsWith(d))&&!t.classList.contains("no-mailgo")||t.hasAttribute("data-tel")&&t.href&&"#mailgo"===t.getAttribute("href").toLowerCase()||t.classList&&t.classList.contains("mailgo"))}function n(e){if(document.contains(ot("mailgo"))&&document.contains(ot("mailgo-tel"))&&!Q(l)&&!Q(c)){var t=e.path||e.composedPath&&e.composedPath()||st(e.target);t&&t.forEach(function(t){if(!(t instanceof HTMLDocument||t instanceof Window))return o(t,l)?(e.preventDefault(),void a(l,t)):o(t,c)?(e.preventDefault(),void a(c,t)):void 0})}}var w,h,x,C,y,k,L,z,A,E,N,j,R,U,I,S,T,M,H,i="mailto:",s="tel:",d="callto:",l="mail",c="tel",W="javascript:void(0);",r="",m="",p="",b="",u="",f="",g="",v="",_="",D="",P=function(){var t="https://mail.google.com/mail/u/0/?view=cm&source=mailto&to="+encodeURIComponent(m);b&&(t=t.concat("&cc="+encodeURIComponent(b))),u&&(t=t.concat("&bcc="+encodeURIComponent(u))),f&&(t=t.concat("&subject="+f)),g&&(t=t.concat("&body="+g)),window.open(t,"_blank"),K()},B=function(){var t="https://outlook.live.com/owa/?path=/mail/action/compose&to="+encodeURIComponent(m);f&&(t=t.concat("&subject="+f)),g&&(t=t.concat("&body="+g)),window.open(t,"_blank"),K()},O=function(){t(p),K()},Z=function(){var t="https://t.me/"+_;window.open(t,"_blank"),K()},F=function(){var t="skype:"+(""!==D?D:v);window.open(t,"_blank"),K()},G=function(){var t="https://wa.me/"+v;window.open(t,"_blank"),K()},V=function(){var t="tel:"+v;window.open(t),K()},$=function(t){var e;lt(t),(e=Q(l)?M:H).textContent="copied",setTimeout(function(){e.textContent="copy",K()},999)},q=function(t){if(Q(l))switch(t.keyCode){case 27:K();break;case 71:P();break;case 79:B();break;case 32:case 13:O();break;case 67:$(m);break;default:return}else if(Q(c))switch(t.keyCode){case 27:K();break;case 84:Z();break;case 87:G();break;case 32:case 13:V();break;case 67:$(v);break;default:return}},J=function(t){var e=0<arguments.length&&void 0!==t?t:l;e!==l?e!==c||it("mailgo-tel","flex"):it("mailgo","flex")},K=function(){it("mailgo","none"),it("mailgo-tel","none"),document.removeEventListener("keydown",q)},Q=function(t){var e=0<arguments.length&&void 0!==t?t:l;return e===l?"flex"===nt("mailgo"):e===c&&"flex"===nt("mailgo-tel")},X=function(){var t=Y("a");return t.href="https://mailgo.js.org?ref=mailgo-modal",t.className="m-by",t.target="_blank",t.rel="noopener noreferrer",t.aC(et("mailgo.js.org")),t},Y=function(t){return document.createElement(t)};HTMLElement.prototype.aC=function(t){return this.appendChild(t)};function tt(t){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(t)}var et=function(t){return document.createTextNode(t)},t=function(t){return window.location.href=i+atob(t)},at=function(t){return btoa(t)},ot=function(t){return document.getElementById(t)},nt=function(t){return ot(t).style.display},it=function(t,e){return ot(t).style.display=e},st=function(t){for(var e=[];t;){if(e.push(t),"HTML"===t.tagName)return e.push(document),e.push(window),e;t=t.parentElement}},dt=function(t){return t.every(tt)},lt=function(t){var e=Y("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",document.body.aC(e);var a=0<document.getSelection().rangeCount&&document.getSelection().getRangeAt(0);e.select(),document.execCommand("copy"),document.body.removeChild(e),a&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(a))};!function(){if(window&&"undefined"!=typeof window){var t=Y("style");t.id="mailgo-style",t.type="text/css",t.aC(et('.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.aC(t),document.addEventListener("DOMContentLoaded",e),document.addEventListener("click",n)}}()}();