a draft of window exists
This commit is contained in:
parent
815405a19d
commit
335cb19a07
@ -38,13 +38,15 @@ let gmailButton,
|
|||||||
callButton,
|
callButton,
|
||||||
copyButton;
|
copyButton;
|
||||||
|
|
||||||
// mailgo style (gulp)
|
if (windowExists()) {
|
||||||
let mailgoCSS = document.createElement("style");
|
// mailgo style (gulp)
|
||||||
mailgoCSS.id = "mailgo-style";
|
let mailgoCSS = document.createElement("style");
|
||||||
mailgoCSS.type = "text/css";
|
mailgoCSS.id = "mailgo-style";
|
||||||
let mailgoCSSContent = document.createTextNode(`MAILGO_STYLE`);
|
mailgoCSS.type = "text/css";
|
||||||
mailgoCSS.appendChild(mailgoCSSContent);
|
let mailgoCSSContent = document.createTextNode(`MAILGO_STYLE`);
|
||||||
document.head.appendChild(mailgoCSS);
|
mailgoCSS.appendChild(mailgoCSSContent);
|
||||||
|
document.head.appendChild(mailgoCSS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mailgoInit
|
* mailgoInit
|
||||||
@ -759,11 +761,14 @@ const mailgoKeydown = event => {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// DOMContentLoaded -> mailgoInit (creates the modals)
|
// if the window object exists...
|
||||||
document.addEventListener("DOMContentLoaded", mailgoInit);
|
if (windowExists()) {
|
||||||
|
// DOMContentLoaded -> mailgoInit (creates the modals)
|
||||||
|
document.addEventListener("DOMContentLoaded", mailgoInit);
|
||||||
|
|
||||||
// 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.addEventListener("click", mailgoCheckRender);
|
document.addEventListener("click", mailgoCheckRender);
|
||||||
|
}
|
||||||
|
|
||||||
// show the modal
|
// show the modal
|
||||||
const showMailgo = (type = MAIL_TYPE) => {
|
const showMailgo = (type = MAIL_TYPE) => {
|
||||||
@ -808,6 +813,9 @@ const encodeEmail = email => btoa(email);
|
|||||||
// getE shorthand
|
// getE shorthand
|
||||||
const getE = id => document.getElementById(id);
|
const getE = id => document.getElementById(id);
|
||||||
|
|
||||||
|
// window exists
|
||||||
|
const windowExists = () => window && typeof window !== "undefined";
|
||||||
|
|
||||||
// get display value
|
// get display value
|
||||||
const getDisplay = id => getE(id).style.display;
|
const getDisplay = id => getE(id).style.display;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user