mailgoIsShowing instead of hidden

This commit is contained in:
Matteo Manzinello 2019-05-21 09:06:03 +02:00
parent b2d8648e3c
commit 2b9c2fe135

View File

@ -390,7 +390,7 @@ const mailgoCheckRender = event => {
*/ */
const mailgoKeydown = (mail, url, mailtoHref, encEmail, copyButton) => { const mailgoKeydown = (mail, url, mailtoHref, encEmail, copyButton) => {
// if mailgo is not showing do nothing // if mailgo is not showing do nothing
if (mailgoHidden()) return; if (!mailgoIsShowing()) return;
switch (event.keyCode) { switch (event.keyCode) {
case 27: case 27:
// Escape // Escape
@ -423,7 +423,7 @@ const mailgoKeydown = (mail, url, mailtoHref, encEmail, copyButton) => {
document.addEventListener("DOMContentLoaded", mailgoInit, false); document.addEventListener("DOMContentLoaded", mailgoInit, false);
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered // event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
document.body.addEventListener("click", mailgoCheckRender, false); document.body.addEventListener("click", mailgoCheckRender, true);
// validate the email with regex // validate the email with regex
const validateEmail = email => { const validateEmail = email => {
@ -463,8 +463,8 @@ const hideMailgo = () => {
}; };
// is the modal hidden? // is the modal hidden?
const mailgoHidden = () => { const mailgoIsShowing = () => {
return getE("mailgo").style.display === "none"; return getE("mailgo").style.display === "flex";
}; };
// decrypt email // decrypt email