This commit is contained in:
Matteo Manzinello 2019-05-13 12:43:46 +02:00
parent 5207390f71
commit 4a402b1871
2 changed files with 19 additions and 8 deletions

25
dist/mailgo.js vendored
View File

@ -155,9 +155,6 @@ mailgoInit = () => {
// add the modal at the end of the body // add the modal at the end of the body
document.body.appendChild(modal); document.body.appendChild(modal);
// add the event mailgoKeydown on mailgo
mailgo.addEventListener("keydown", mailgoKeydown, false);
// every click outside the modal will hide the modal // every click outside the modal will hide the modal
modalBackground.addEventListener("click", hideMailgo, false); modalBackground.addEventListener("click", hideMailgo, false);
}; };
@ -208,6 +205,12 @@ mailgoRender = mailgo => {
"@" + "@" +
mailgo.getAttribute("data-cc-domain"); mailgo.getAttribute("data-cc-domain");
// bcc = data-bcc-address + @ + data-bcc-domain
bcc =
mailgo.getAttribute("data-bcc-address") +
"@" +
mailgo.getAttribute("data-bcc-domain");
// subject = data-subject // subject = data-subject
subject = mailgo.getAttribute("data-subject"); subject = mailgo.getAttribute("data-subject");
@ -218,8 +221,9 @@ mailgoRender = mailgo => {
// validate the email address // validate the email address
if (!validateEmail(mail)) return; if (!validateEmail(mail)) return;
// if cc is not valid cc = "" // if cc, bcc is not valid cc, bcc = ""
if (!validateEmail(cc)) cc = ""; if (!validateEmail(cc)) cc = "";
if (!validateEmail(bcc)) bcc = "";
// information // information
titleEl = getE("mailgo-title"); titleEl = getE("mailgo-title");
@ -379,11 +383,18 @@ copyToClipboard = str => {
}; };
// show the modal // show the modal
showMailgo = () => (getE("mailgo").style.display = "flex"); showMailgo = () => {
getE("mailgo").style.display = "flex";
// add mailgoKeydown
document.body.addEventListener("keydown", mailgoKeydown, false);
};
// hide the modal // hide the modal
hideMailgo = () => (getE("mailgo").style.display = "none"); hideMailgo = () => {
getE("mailgo").style.display = "none";
// remove mailgoKeydown
document.body.removeEventListener("keydown", mailgoKeydown, false);
};
// decrypt email // decrypt email
mailToEncoded = encoded => (window.location.href = MAILTO + atob(encoded)); mailToEncoded = encoded => (window.location.href = MAILTO + atob(encoded));

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long