esport default mailgo

This commit is contained in:
Matteo Manzinello 2020-04-24 12:00:23 +02:00
parent 83472abeee
commit b5000f476f
3 changed files with 20 additions and 21 deletions

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
const mailgoVersion: string = "MAILGO_VERSION"; const mailgoVersion: string = "MAILGO_VERSION";
(() => { const mailgo = () => {
// links // links
const MAILTO: string = "mailto:"; const MAILTO: string = "mailto:";
const TEL: string = "tel:"; const TEL: string = "tel:";
@ -750,9 +750,6 @@ const mailgoVersion: string = "MAILGO_VERSION";
return by; return by;
}; };
// window exists
const windowExists = () => window && typeof window !== "undefined";
// create element // create element
const createElement = (element: string = "div") => const createElement = (element: string = "div") =>
document.createElement(element); document.createElement(element);
@ -827,11 +824,8 @@ const mailgoVersion: string = "MAILGO_VERSION";
// start mailgo // start mailgo
(() => { (() => {
// if the window object exists... // if the window object exists...
if (windowExists()) {
// mailgo style (gulp) // mailgo style (gulp)
let mailgoCSS: HTMLStyleElement = <HTMLStyleElement>( let mailgoCSS: HTMLStyleElement = <HTMLStyleElement>createElement("style");
createElement("style")
);
mailgoCSS.id = "mailgo-style"; mailgoCSS.id = "mailgo-style";
mailgoCSS.type = "text/css"; mailgoCSS.type = "text/css";
mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`)); mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`));
@ -842,6 +836,11 @@ const mailgoVersion: string = "MAILGO_VERSION";
// 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);
})();
};
if (window && typeof window !== "undefined") {
mailgo();
} }
})();
})(); export default mailgo();