now modals are global objects
This commit is contained in:
parent
d455cf2849
commit
ddfd1611db
2
dist/mailgo.dark.min.js
vendored
2
dist/mailgo.dark.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.dark.min.js.map
vendored
2
dist/mailgo.dark.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mailgo.min.js.map
vendored
2
dist/mailgo.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -263,7 +263,9 @@ var pHTMLTag = "p"; // global mailgo config object
|
|||||||
|
|
||||||
var config; // default language
|
var config; // default language
|
||||||
|
|
||||||
var lang = DEFAULT_LANG; // mailgo variables
|
var lang = DEFAULT_LANG; // modals global object
|
||||||
|
|
||||||
|
var modalMailto, modalTel; // mailgo variables
|
||||||
|
|
||||||
var url,
|
var url,
|
||||||
mail = "",
|
mail = "",
|
||||||
@ -317,23 +319,23 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
|||||||
var _config3;
|
var _config3;
|
||||||
|
|
||||||
// modal
|
// modal
|
||||||
var modal = createElement();
|
modalMailto = createElement();
|
||||||
modal.style.display = "none";
|
modalMailto.style.display = "none";
|
||||||
modal.id = "mailgo";
|
modalMailto.id = "mailgo";
|
||||||
modal.classList.add("m-modal"); // if dark is in config
|
modalMailto.classList.add("m-modal"); // if dark is in config
|
||||||
|
|
||||||
if ((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.dark) {
|
if ((_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.dark) {
|
||||||
modal.classList.add("m-dark");
|
modalMailto.classList.add("m-dark");
|
||||||
} // background
|
} // background
|
||||||
|
|
||||||
|
|
||||||
var modalBackground = createElement();
|
var modalBackground = createElement();
|
||||||
modalBackground.className = "m-modal-back";
|
modalBackground.className = "m-modal-back";
|
||||||
modal.appendChild(modalBackground); // modal content
|
modalMailto.appendChild(modalBackground); // modal content
|
||||||
|
|
||||||
var modalContent = createElement();
|
var modalContent = createElement();
|
||||||
modalContent.className = "m-modal-content";
|
modalContent.className = "m-modal-content";
|
||||||
modal.appendChild(modalContent); // title (email address)
|
modalMailto.appendChild(modalContent); // title (email address)
|
||||||
|
|
||||||
title = createElement("strong");
|
title = createElement("strong");
|
||||||
title.id = "m-title";
|
title.id = "m-title";
|
||||||
@ -430,7 +432,7 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
|||||||
modalContent.appendChild(copyMail);
|
modalContent.appendChild(copyMail);
|
||||||
modalContent.appendChild(byElement()); // add the modal at the end of the body
|
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);
|
modalBackground.addEventListener("click", hideMailgo);
|
||||||
} // mailgo tel
|
} // mailgo tel
|
||||||
@ -439,32 +441,25 @@ var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
|||||||
var _config4;
|
var _config4;
|
||||||
|
|
||||||
// modal
|
// modal
|
||||||
var _modal = createElement();
|
modalTel = createElement();
|
||||||
|
modalTel.style.display = "none";
|
||||||
_modal.style.display = "none";
|
modalTel.id = "mailgo-tel";
|
||||||
_modal.id = "mailgo-tel";
|
modalTel.classList.add("m-modal"); // if dark is in config
|
||||||
|
|
||||||
_modal.classList.add("m-modal"); // if dark is in config
|
|
||||||
|
|
||||||
|
|
||||||
if ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.dark) {
|
if ((_config4 = config) === null || _config4 === void 0 ? void 0 : _config4.dark) {
|
||||||
_modal.classList.add("m-dark");
|
modalTel.classList.add("m-dark");
|
||||||
} // background
|
} // background
|
||||||
|
|
||||||
|
|
||||||
var _modalBackground = createElement();
|
var _modalBackground = createElement();
|
||||||
|
|
||||||
_modalBackground.className = "m-modal-back";
|
_modalBackground.className = "m-modal-back";
|
||||||
|
modalTel.appendChild(_modalBackground); // modal content
|
||||||
_modal.appendChild(_modalBackground); // modal content
|
|
||||||
|
|
||||||
|
|
||||||
var _modalContent = createElement();
|
var _modalContent = createElement();
|
||||||
|
|
||||||
_modalContent.className = "m-modal-content";
|
_modalContent.className = "m-modal-content";
|
||||||
|
modalTel.appendChild(_modalContent); // title (telephone number)
|
||||||
_modal.appendChild(_modalContent); // title (telephone number)
|
|
||||||
|
|
||||||
|
|
||||||
titleTel = createElement("strong");
|
titleTel = createElement("strong");
|
||||||
titleTel.id = "m-tel-title";
|
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
|
_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);
|
_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
|
||||||
|
File diff suppressed because one or more lines are too long
@ -37,6 +37,9 @@ let config: MailgoConfig;
|
|||||||
// default language
|
// default language
|
||||||
let lang: string = DEFAULT_LANG;
|
let lang: string = DEFAULT_LANG;
|
||||||
|
|
||||||
|
// modals global object
|
||||||
|
let modalMailto: HTMLElement, modalTel: HTMLElement;
|
||||||
|
|
||||||
// mailgo variables
|
// mailgo variables
|
||||||
let url: URL,
|
let url: URL,
|
||||||
mail: string = "",
|
mail: string = "",
|
||||||
@ -111,25 +114,25 @@ const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
// mailgo mail
|
// mailgo mail
|
||||||
{
|
{
|
||||||
// modal
|
// modal
|
||||||
let modal: HTMLElement = createElement();
|
modalMailto = createElement() as HTMLElement;
|
||||||
modal.style.display = "none";
|
modalMailto.style.display = "none";
|
||||||
modal.id = "mailgo";
|
modalMailto.id = "mailgo";
|
||||||
modal.classList.add("m-modal");
|
modalMailto.classList.add("m-modal");
|
||||||
|
|
||||||
// if dark is in config
|
// if dark is in config
|
||||||
if (config?.dark) {
|
if (config?.dark) {
|
||||||
modal.classList.add("m-dark");
|
modalMailto.classList.add("m-dark");
|
||||||
}
|
}
|
||||||
|
|
||||||
// background
|
// background
|
||||||
let modalBackground: HTMLElement = createElement();
|
let modalBackground: HTMLElement = createElement();
|
||||||
modalBackground.className = "m-modal-back";
|
modalBackground.className = "m-modal-back";
|
||||||
modal.appendChild(modalBackground);
|
modalMailto.appendChild(modalBackground);
|
||||||
|
|
||||||
// modal content
|
// modal content
|
||||||
let modalContent: HTMLElement = createElement();
|
let modalContent: HTMLElement = createElement();
|
||||||
modalContent.className = "m-modal-content";
|
modalContent.className = "m-modal-content";
|
||||||
modal.appendChild(modalContent);
|
modalMailto.appendChild(modalContent);
|
||||||
|
|
||||||
// title (email address)
|
// title (email address)
|
||||||
title = createElement("strong");
|
title = createElement("strong");
|
||||||
@ -255,7 +258,7 @@ const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
modalContent.appendChild(byElement());
|
modalContent.appendChild(byElement());
|
||||||
|
|
||||||
// add the modal at the end of the body
|
// add the modal at the end of the body
|
||||||
document.body.appendChild(modal);
|
document.body.appendChild(modalMailto);
|
||||||
|
|
||||||
// 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);
|
||||||
@ -263,25 +266,25 @@ const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
// mailgo tel
|
// mailgo tel
|
||||||
{
|
{
|
||||||
// modal
|
// modal
|
||||||
let modal: HTMLElement = createElement();
|
modalTel = createElement() as HTMLElement;
|
||||||
modal.style.display = "none";
|
modalTel.style.display = "none";
|
||||||
modal.id = "mailgo-tel";
|
modalTel.id = "mailgo-tel";
|
||||||
modal.classList.add("m-modal");
|
modalTel.classList.add("m-modal");
|
||||||
|
|
||||||
// if dark is in config
|
// if dark is in config
|
||||||
if (config?.dark) {
|
if (config?.dark) {
|
||||||
modal.classList.add("m-dark");
|
modalTel.classList.add("m-dark");
|
||||||
}
|
}
|
||||||
|
|
||||||
// background
|
// background
|
||||||
let modalBackground: HTMLElement = createElement();
|
let modalBackground: HTMLElement = createElement();
|
||||||
modalBackground.className = "m-modal-back";
|
modalBackground.className = "m-modal-back";
|
||||||
modal.appendChild(modalBackground);
|
modalTel.appendChild(modalBackground);
|
||||||
|
|
||||||
// modal content
|
// modal content
|
||||||
let modalContent: HTMLElement = createElement();
|
let modalContent: HTMLElement = createElement();
|
||||||
modalContent.className = "m-modal-content";
|
modalContent.className = "m-modal-content";
|
||||||
modal.appendChild(modalContent);
|
modalTel.appendChild(modalContent);
|
||||||
|
|
||||||
// title (telephone number)
|
// title (telephone number)
|
||||||
titleTel = createElement("strong");
|
titleTel = createElement("strong");
|
||||||
@ -374,7 +377,7 @@ const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
modalContent.appendChild(byElement());
|
modalContent.appendChild(byElement());
|
||||||
|
|
||||||
// add the modal at the end of the body
|
// add the modal at the end of the body
|
||||||
document.body.appendChild(modal);
|
document.body.appendChild(modalTel);
|
||||||
|
|
||||||
// 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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user