getDisplay e setDisplay

This commit is contained in:
Matteo Manzinello 2019-09-16 22:33:19 +02:00
parent 4d5940f86b
commit fb5ad12477

View File

@ -1,9 +1,13 @@
// @flow // @flow
const V = "MAILGO_VERSION"; const V = "MAILGO_VERSION";
const MAILTO = "mailto:"; const MAILTO = "mailto:";
const TEL = "tel:"; const TEL = "tel:";
const CALLTO = "callto:"; const CALLTO = "callto:";
const MAIL_TYPE = "mail";
const TEL_TYPE = "tel";
// mailgo style (gulp) // mailgo style (gulp)
const mailgoCSS = document.createElement("style"); const mailgoCSS = document.createElement("style");
mailgoCSS.id = "mailgo-style"; mailgoCSS.id = "mailgo-style";
@ -638,16 +642,17 @@ const showMailgo = () => (getE("mailgo").style.display = "flex");
const showMailgoTel = () => (getE("mailgo-tel").style.display = "flex"); const showMailgoTel = () => (getE("mailgo-tel").style.display = "flex");
// hide the modal // hide the modal
const hideMailgo = () => ( const hideMailgo = () => {
(getE("mailgo").style.display = "none"), getE("mailgo").style.display = "none";
(getE("mailgo-tel").style.display = "none") getE("mailgo-tel").style.display = "none";
); };
// is the mailgo modal hidden? // is the mailgo modal hidden?
const mailgoIsShowing = () => getE("mailgo").style.display === "flex"; const mailgoIsShowing = type => {
type === TEL_TYPE
// is the mailgo tel modal hidden? ? getE("mailgo").style.display === "flex"
const mailgoTelIsShowing = () => getE("mailgo-tel").style.display === "flex"; : getE("mailgo-tel").style.display === "flex";
};
// decrypt email // decrypt email
const mailToEncoded = encoded => const mailToEncoded = encoded =>
@ -659,6 +664,12 @@ const encodeEmail = email => btoa(email);
// getE shorthand // getE shorthand
const getE = id => document.getElementById(id); const getE = id => document.getElementById(id);
// get display value
const getDisplay = id => getE(id).style.display;
// get display value
const setDisplay = (id, value) => (getE(id).style.display = value);
// custom composedPath if path or event.composedPath() are not defined // custom composedPath if path or event.composedPath() are not defined
const composedPath = el => { const composedPath = el => {
let path = []; let path = [];