added a check for #mailgo or #mailgo-tel already existing in the page

This commit is contained in:
Matteo Manzinello 2020-07-31 15:41:54 +02:00
parent cb0dcb128b
commit cf8ff056c8
11 changed files with 20 additions and 17 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -316,9 +316,9 @@ var mailgoInit = function mailgoInit() {
var defaultStrings = translations[DEFAULT_LANG]; var defaultStrings = translations[DEFAULT_LANG];
var strings = translations[lang]; // mailgo mail var strings = translations[lang]; // mailgo tel, if mailgo not already exists
{ if (!document.getElementById("mailgo")) {
var _config3, _config4, _config5; var _config3, _config4, _config5;
// modal // modal
@ -447,9 +447,10 @@ var mailgoInit = function mailgoInit() {
document.body.appendChild(modalMailto); // every click outside the modal will hide the modal document.body.appendChild(modalMailto); // every click outside the modal will hide the modal
modalBackground.addEventListener("click", hideMailgo); modalBackground.addEventListener("click", hideMailgo);
} // mailgo tel } // mailgo tel, if mailgo-tel not already exists
{
if (!document.getElementById("mailgo-tel")) {
var _config6, _config7, _config8; var _config6, _config7, _config8;
// modal // modal
@ -563,6 +564,7 @@ var mailgoInit = function mailgoInit() {
_modalBackground.addEventListener("click", hideMailgo); _modalBackground.addEventListener("click", hideMailgo);
} // 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);
}; };
/** /**

File diff suppressed because one or more lines are too long

View File

@ -112,8 +112,8 @@ const mailgoInit = (): void => {
let defaultStrings: MailgoTranslation = translations[DEFAULT_LANG]; let defaultStrings: MailgoTranslation = translations[DEFAULT_LANG];
let strings: MailgoTranslation = translations[lang]; let strings: MailgoTranslation = translations[lang];
// mailgo mail // mailgo tel, if mailgo not already exists
{ if (!document.getElementById("mailgo")) {
// modal // modal
modalMailto = createElement() as HTMLElement; modalMailto = createElement() as HTMLElement;
modalMailto.style.display = "none"; modalMailto.style.display = "none";
@ -275,8 +275,9 @@ const mailgoInit = (): void => {
// every click outside the modal will hide the modal // every click outside the modal will hide the modal
modalBackground.addEventListener("click", hideMailgo); modalBackground.addEventListener("click", hideMailgo);
} }
// mailgo tel
{ // mailgo tel, if mailgo-tel not already exists
if (!document.getElementById("mailgo-tel")) {
// modal // modal
modalTel = createElement() as HTMLElement; modalTel = createElement() as HTMLElement;
modalTel.style.display = "none"; modalTel.style.display = "none";