functions showMailgo and hideMailgo

This commit is contained in:
Matteo Manzinello
2019-05-11 10:03:51 +02:00
parent b9fcffa127
commit 56e7d2bcd0
3 changed files with 19 additions and 11 deletions

View File

@@ -226,7 +226,7 @@ mailgoInit = () => {
event.preventDefault();
// modal is now showing
mailgo.nextElementSibling.style.display = "flex";
showMailgo(mailgo.nextElementSibling);
},
false
);
@@ -236,7 +236,7 @@ mailgoInit = () => {
"keydown",
event => {
if (event.keyCode === 27) {
mailgo.nextElementSibling.style.display = "flex";
hideMailgo(mailgo.nextElementSibling);
}
},
false
@@ -245,9 +245,7 @@ mailgoInit = () => {
// every click outside the modal will hide the modal
modalBackground.addEventListener(
"click",
event => {
mailgo.nextElementSibling.style.display = "none";
},
event => hideMailgo(mailgo.nextElementSibling),
false
);
});
@@ -283,6 +281,12 @@ copyToClipboard = str => {
}
};
// show the modal
showMailgo = m => (m.style.display = "flex");
// hide the modal
hideMailgo = m => (m.style.display = "none");
// decrypt email
mailToEncoded = encoded => (window.location.href = MAILTO + atob(encoded));