now modals are global objects
This commit is contained in:
@@ -263,7 +263,9 @@ var pHTMLTag = "p"; // global mailgo config object
|
||||
|
||||
var config; // default language
|
||||
|
||||
var lang = DEFAULT_LANG; // mailgo variables
|
||||
var lang = DEFAULT_LANG; // modals global object
|
||||
|
||||
var modalMailto, modalTel; // mailgo variables
|
||||
|
||||
var url,
|
||||
mail = "",
|
||||
@@ -317,23 +319,23 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
||||
var _config3;
|
||||
|
||||
// modal
|
||||
var modal = createElement();
|
||||
modal.style.display = "none";
|
||||
modal.id = "mailgo";
|
||||
modal.classList.add("m-modal"); // if dark is in config
|
||||
modalMailto = createElement();
|
||||
modalMailto.style.display = "none";
|
||||
modalMailto.id = "mailgo";
|
||||
modalMailto.classList.add("m-modal"); // if dark is in config
|
||||
|
||||
if ((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.dark) {
|
||||
modal.classList.add("m-dark");
|
||||
modalMailto.classList.add("m-dark");
|
||||
} // background
|
||||
|
||||
|
||||
var modalBackground = createElement();
|
||||
modalBackground.className = "m-modal-back";
|
||||
modal.appendChild(modalBackground); // modal content
|
||||
modalMailto.appendChild(modalBackground); // modal content
|
||||
|
||||
var modalContent = createElement();
|
||||
modalContent.className = "m-modal-content";
|
||||
modal.appendChild(modalContent); // title (email address)
|
||||
modalMailto.appendChild(modalContent); // title (email address)
|
||||
|
||||
title = createElement("strong");
|
||||
title.id = "m-title";
|
||||
@@ -430,7 +432,7 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
||||
modalContent.appendChild(copyMail);
|
||||
modalContent.appendChild(byElement()); // add the modal at the end of the body
|
||||
|
||||
document.body.appendChild(modal); // 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);
|
||||
} // mailgo tel
|
||||
@@ -439,32 +441,25 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
||||
var _config4;
|
||||
|
||||
// modal
|
||||
var _modal = createElement();
|
||||
|
||||
_modal.style.display = "none";
|
||||
_modal.id = "mailgo-tel";
|
||||
|
||||
_modal.classList.add("m-modal"); // if dark is in config
|
||||
|
||||
modalTel = createElement();
|
||||
modalTel.style.display = "none";
|
||||
modalTel.id = "mailgo-tel";
|
||||
modalTel.classList.add("m-modal"); // if dark is in config
|
||||
|
||||
if ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.dark) {
|
||||
_modal.classList.add("m-dark");
|
||||
modalTel.classList.add("m-dark");
|
||||
} // background
|
||||
|
||||
|
||||
var _modalBackground = createElement();
|
||||
|
||||
_modalBackground.className = "m-modal-back";
|
||||
|
||||
_modal.appendChild(_modalBackground); // modal content
|
||||
|
||||
modalTel.appendChild(_modalBackground); // modal content
|
||||
|
||||
var _modalContent = createElement();
|
||||
|
||||
_modalContent.className = "m-modal-content";
|
||||
|
||||
_modal.appendChild(_modalContent); // title (telephone number)
|
||||
|
||||
modalTel.appendChild(_modalContent); // title (telephone number)
|
||||
|
||||
titleTel = createElement("strong");
|
||||
titleTel.id = "m-tel-title";
|
||||
@@ -543,7 +538,7 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
||||
_modalContent.appendChild(byElement()); // add the modal at the end of the body
|
||||
|
||||
|
||||
document.body.appendChild(_modal); // every click outside the modal will hide the modal
|
||||
document.body.appendChild(modalTel); // every click outside the modal will hide the modal
|
||||
|
||||
_modalBackground.addEventListener("click", hideMailgo);
|
||||
} // event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user