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