aggiunto by

This commit is contained in:
Matteo Manzinello 2019-05-04 01:40:58 +02:00
parent a2a47b1f39
commit dbfaccd687
5 changed files with 96 additions and 3631 deletions

25
dist/mailgo.js vendored
View File

@ -75,6 +75,15 @@ let styles = `
margin-top: 10px; margin-top: 10px;
padding: 16px 10px; padding: 16px 10px;
} }
.mailgo-by {
display: block;
font-size: 8px;
padding: 5px;
margin-top: 0.75rem;
}
.mailgo-by:hover {
background-color: none;
}
`; `;
// CSS // CSS
@ -121,6 +130,12 @@ mailgos.forEach((mailgo, index) => {
strong.appendChild(strongContent); strong.appendChild(strongContent);
modalContent.appendChild(strong); modalContent.appendChild(strong);
// details
let details = document.createElement("div");
details.className = "mailgo-details";
modalContent.appendChild(details);
// Gmail // Gmail
let gmail = document.createElement("a"); let gmail = document.createElement("a");
gmail.href = "https://mail.google.com/mail?extsrc=mailto&url=" + mailgo.href; gmail.href = "https://mail.google.com/mail?extsrc=mailto&url=" + mailgo.href;
@ -164,6 +179,16 @@ mailgos.forEach((mailgo, index) => {
); );
modalContent.appendChild(copy); modalContent.appendChild(copy);
// details
let by = document.createElement("a");
by.href = "https://mailgo.js.org";
by.className = "mailgo-by";
let textBy = document.createTextNode("mailgo.js.org");
by.appendChild(textBy);
modalContent.appendChild(by);
mailgo.parentNode.insertBefore(modal, mailgo.nextSibling); mailgo.parentNode.insertBefore(modal, mailgo.nextSibling);
mailgo.addEventListener( mailgo.addEventListener(

2
dist/mailgo.min.js vendored
View File

@ -1 +1 @@
let mailgos=document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)'),styles='\n\n .mailgo-modal {\n all: initial;\n * {\n all: unset;\n }\n }\n\n .mailgo-title {\n display: block;\n margin-bottom: 16px;\n }\n\n .mailgo-modal-background {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(10,10,10,.86);\n opacity: 0.8;\n }\n .mailgo-modal {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n }\n .mailgo-modal.is-active {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .mailgo-modal-content {\n z-index: 1000;\n text-align: center;\n width: 200px;\n background-color: #fff;\n border-radius: 6px;\n box-shadow: 0 2px 3px rgba(10,10,10,.1), 0 0 0 1px rgba(10,10,10,.1);\n color: #4a4a4a;\n display: block;\n padding: 1.25rem;\n }\n .mailgo-modal-content a {\n display: block;\n color: #4a4a4a;\n padding: 10px;\n border-radius: 4px;\n text-decoration: none;\n }\n .mailgo-modal-content a:hover {\n background-color: rgba(0, 0, 0, 0.08);\n }\n .mailgo-modal-content a.outlook {\n color: rgba(0, 114, 198);\n }\n .mailgo-modal-content a.gmail {\n color: rgba(212, 70, 56);\n }\n .mailgo-modal-content a.outlook:hover {\n background-color: rgba(0, 114, 198, 0.08);\n }\n .mailgo-modal-content a.gmail:hover {\n background-color: rgba(212, 70, 56, 0.08);\n }\n a.mailgo-copy {\n margin-top: 10px;\n padding: 16px 10px;\n }\n',styleSheet=document.createElement("style");function validateEmail(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)}function copyToClipboard(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t);const n=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);t.select(),document.execCommand("copy"),document.body.removeChild(t),n&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n))}styleSheet.type="text/css",styleSheet.innerText=styles,document.head.appendChild(styleSheet),console.log("mailgo is WIP!"),mailgos.forEach((e,t)=>{let n=e.href.split("?")[0].split("mailto:")[1].trim();if(!validateEmail(n))return;let o=new URL(e.href),a=new URLSearchParams(o.search),l=(a.get("subject"),a.get("body"),a.get("cc"),a.get("bcc"),document.createElement("div"));l.className="mailgo-modal",l.setAttribute("data-index",t);let i=document.createElement("div");i.className="mailgo-modal-background",l.appendChild(i);let d=document.createElement("div");d.className="mailgo-modal-content",l.appendChild(d);let c=document.createElement("strong");c.className="mailgo-title";let m=document.createTextNode(n);c.appendChild(m),d.appendChild(c);let r=document.createElement("a");r.href="https://mail.google.com/mail?extsrc=mailto&url="+e.href,r.classList.add("mailgo-open"),r.classList.add("gmail");let s=document.createTextNode("open in Gmail");r.appendChild(s),d.appendChild(r);let p=document.createElement("a");p.href="https://outlook.office.com/owa/?rru=compose&to="+n+o.search,p.classList.add("mailgo-open"),p.classList.add("outlook");let g=document.createTextNode("open in Outlook");p.appendChild(g),d.appendChild(p);let u=document.createElement("a");u.href=e.href,u.className="mailgo-open";let h=document.createTextNode("open");u.appendChild(h),d.appendChild(u);let b=document.createElement("a");b.href="#mailgo-copy",b.className="mailgo-copy";let y=document.createTextNode("copy");b.appendChild(y),b.addEventListener("click",e=>{copyToClipboard(n),b.innerHTML="copied!"},!1),d.appendChild(b),e.parentNode.insertBefore(l,e.nextSibling),e.addEventListener("click",t=>{t.preventDefault(),e.nextElementSibling.classList.add("is-active")},!1),i.addEventListener("click",t=>{e.nextElementSibling.classList.remove("is-active")},!1)}); let mailgos=document.querySelectorAll('a[href^="mailto:"]:not(.no-mailgo)'),styles='\n\n .mailgo-modal {\n all: initial;\n * {\n all: unset;\n }\n }\n\n .mailgo-title {\n display: block;\n margin-bottom: 16px;\n }\n\n .mailgo-modal-background {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(10,10,10,.86);\n opacity: 0.8;\n }\n .mailgo-modal {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";\n }\n .mailgo-modal.is-active {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .mailgo-modal-content {\n z-index: 1000;\n text-align: center;\n width: 200px;\n background-color: #fff;\n border-radius: 6px;\n box-shadow: 0 2px 3px rgba(10,10,10,.1), 0 0 0 1px rgba(10,10,10,.1);\n color: #4a4a4a;\n display: block;\n padding: 1.25rem;\n }\n .mailgo-modal-content a {\n display: block;\n color: #4a4a4a;\n padding: 10px;\n border-radius: 4px;\n text-decoration: none;\n }\n .mailgo-modal-content a:hover {\n background-color: rgba(0, 0, 0, 0.08);\n }\n .mailgo-modal-content a.outlook {\n color: rgba(0, 114, 198);\n }\n .mailgo-modal-content a.gmail {\n color: rgba(212, 70, 56);\n }\n .mailgo-modal-content a.outlook:hover {\n background-color: rgba(0, 114, 198, 0.08);\n }\n .mailgo-modal-content a.gmail:hover {\n background-color: rgba(212, 70, 56, 0.08);\n }\n a.mailgo-copy {\n margin-top: 10px;\n padding: 16px 10px;\n }\n .mailgo-by {\n display: block;\n font-size: 8px;\n padding: 5px;\n margin-top: 0.75rem;\n }\n .mailgo-by:hover {\n background-color: none;\n }\n',styleSheet=document.createElement("style");function validateEmail(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)}function copyToClipboard(e){const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n);const t=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);n.select(),document.execCommand("copy"),document.body.removeChild(n),t&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(t))}styleSheet.type="text/css",styleSheet.innerText=styles,document.head.appendChild(styleSheet),console.log("mailgo is WIP!"),mailgos.forEach((e,n)=>{let t=e.href.split("?")[0].split("mailto:")[1].trim();if(!validateEmail(t))return;let o=new URL(e.href),a=new URLSearchParams(o.search),l=(a.get("subject"),a.get("body"),a.get("cc"),a.get("bcc"),document.createElement("div"));l.className="mailgo-modal",l.setAttribute("data-index",n);let i=document.createElement("div");i.className="mailgo-modal-background",l.appendChild(i);let d=document.createElement("div");d.className="mailgo-modal-content",l.appendChild(d);let c=document.createElement("strong");c.className="mailgo-title";let m=document.createTextNode(t);c.appendChild(m),d.appendChild(c);let r=document.createElement("div");r.className="mailgo-details",d.appendChild(r);let s=document.createElement("a");s.href="https://mail.google.com/mail?extsrc=mailto&url="+e.href,s.classList.add("mailgo-open"),s.classList.add("gmail");let p=document.createTextNode("open in Gmail");s.appendChild(p),d.appendChild(s);let g=document.createElement("a");g.href="https://outlook.office.com/owa/?rru=compose&to="+t+o.search,g.classList.add("mailgo-open"),g.classList.add("outlook");let u=document.createTextNode("open in Outlook");g.appendChild(u),d.appendChild(g);let h=document.createElement("a");h.href=e.href,h.className="mailgo-open";let b=document.createTextNode("open");h.appendChild(b),d.appendChild(h);let y=document.createElement("a");y.href="#mailgo-copy",y.className="mailgo-copy";let x=document.createTextNode("copy");y.appendChild(x),y.addEventListener("click",e=>{copyToClipboard(t),y.innerHTML="copied!"},!1),d.appendChild(y);let f=document.createElement("a");f.href="https://mailgo.js.org",f.className="mailgo-by";let C=document.createTextNode("mailgo.js.org");f.appendChild(C),d.appendChild(f),e.parentNode.insertBefore(l,e.nextSibling),e.addEventListener("click",n=>{n.preventDefault(),e.nextElementSibling.classList.add("is-active")},!1),i.addEventListener("click",n=>{e.nextElementSibling.classList.remove("is-active")},!1)});

3628
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,15 @@ let styles = `
margin-top: 10px; margin-top: 10px;
padding: 16px 10px; padding: 16px 10px;
} }
.mailgo-by {
display: block;
font-size: 8px;
padding: 5px;
margin-top: 0.75rem;
}
.mailgo-by:hover {
background-color: none;
}
`; `;
// CSS // CSS
@ -121,6 +130,12 @@ mailgos.forEach((mailgo, index) => {
strong.appendChild(strongContent); strong.appendChild(strongContent);
modalContent.appendChild(strong); modalContent.appendChild(strong);
// details
let details = document.createElement("div");
details.className = "mailgo-details";
modalContent.appendChild(details);
// Gmail // Gmail
let gmail = document.createElement("a"); let gmail = document.createElement("a");
gmail.href = "https://mail.google.com/mail?extsrc=mailto&url=" + mailgo.href; gmail.href = "https://mail.google.com/mail?extsrc=mailto&url=" + mailgo.href;
@ -164,6 +179,16 @@ mailgos.forEach((mailgo, index) => {
); );
modalContent.appendChild(copy); modalContent.appendChild(copy);
// details
let by = document.createElement("a");
by.href = "https://mailgo.js.org";
by.className = "mailgo-by";
let textBy = document.createTextNode("mailgo.js.org");
by.appendChild(textBy);
modalContent.appendChild(by);
mailgo.parentNode.insertBefore(modal, mailgo.nextSibling); mailgo.parentNode.insertBefore(modal, mailgo.nextSibling);
mailgo.addEventListener( mailgo.addEventListener(

View File

@ -355,7 +355,7 @@ color-support@^1.1.3:
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==
commander@^2.19.0: commander@^2.19.0, commander@~2.20.0:
version "2.20.0" version "2.20.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
@ -891,6 +891,22 @@ gulp-terser@^1.1.7:
through2 "^3.0.0" through2 "^3.0.0"
vinyl-sourcemaps-apply "^0.2.1" vinyl-sourcemaps-apply "^0.2.1"
gulp-uglify@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.2.tgz#5f5b2e8337f879ca9dec971feb1b82a5a87850b0"
integrity sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg==
dependencies:
array-each "^1.0.1"
extend-shallow "^3.0.2"
gulplog "^1.0.0"
has-gulplog "^0.1.0"
isobject "^3.0.1"
make-error-cause "^1.1.1"
safe-buffer "^5.1.2"
through2 "^2.0.0"
uglify-js "^3.0.5"
vinyl-sourcemaps-apply "^0.2.0"
gulp@^4.0.1: gulp@^4.0.1:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/gulp/-/gulp-4.0.1.tgz#987a38a55a7d3677f6b49e291b06bc05809f33d9" resolved "https://registry.yarnpkg.com/gulp/-/gulp-4.0.1.tgz#987a38a55a7d3677f6b49e291b06bc05809f33d9"
@ -908,6 +924,13 @@ gulplog@^1.0.0:
dependencies: dependencies:
glogg "^1.0.0" glogg "^1.0.0"
has-gulplog@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce"
integrity sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=
dependencies:
sparkles "^1.0.0"
has-symbols@^1.0.0: has-symbols@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44"
@ -1280,6 +1303,18 @@ load-json-file@^1.0.0:
pinkie-promise "^2.0.0" pinkie-promise "^2.0.0"
strip-bom "^2.0.0" strip-bom "^2.0.0"
make-error-cause@^1.1.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d"
integrity sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=
dependencies:
make-error "^1.2.0"
make-error@^1.2.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8"
integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==
make-iterator@^1.0.0: make-iterator@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6"
@ -2270,6 +2305,14 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
uglify-js@^3.0.5:
version "3.5.10"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.10.tgz#652bef39f86d9dbfd6674407ee05a5e2d372cf2d"
integrity sha512-/GTF0nosyPLbdJBd+AwYiZ+Hu5z8KXWnO0WCGt1BQ/u9Iamhejykqmz5o1OHJ53+VAk6xVxychonnApDjuqGsw==
dependencies:
commander "~2.20.0"
source-map "~0.6.1"
unc-path-regex@^0.1.2: unc-path-regex@^0.1.2:
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
@ -2397,7 +2440,7 @@ vinyl-sourcemap@^1.1.0:
remove-bom-buffer "^3.0.0" remove-bom-buffer "^3.0.0"
vinyl "^2.0.0" vinyl "^2.0.0"
vinyl-sourcemaps-apply@^0.2.1: vinyl-sourcemaps-apply@^0.2.0, vinyl-sourcemaps-apply@^0.2.1:
version "0.2.1" version "0.2.1"
resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705"
integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=