mailymaily/dist/mailgo.min.js
2019-10-28 08:40:22 +01:00

1 line
16 KiB
JavaScript

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