go on with tel
This commit is contained in:
parent
1080b180c3
commit
bf1484a2a0
@ -29,9 +29,11 @@ document.head.appendChild(mailgoCSS);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* mailgoInit
|
* mailgoInit
|
||||||
* the function that creates the mailgo element in DOM
|
* the function that creates the mailgo elements in DOM
|
||||||
*/
|
*/
|
||||||
const mailgoInit = () => {
|
const mailgoInit = () => {
|
||||||
|
// mailgo mail
|
||||||
|
{
|
||||||
// modal
|
// modal
|
||||||
let modal = document.createElement("div");
|
let modal = document.createElement("div");
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
@ -184,13 +186,9 @@ const mailgoInit = () => {
|
|||||||
|
|
||||||
// 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
|
||||||
/**
|
{
|
||||||
* mailgoTelInit
|
|
||||||
* the function that creates the mailgo (for tel:) element in DOM
|
|
||||||
*/
|
|
||||||
const mailgoTelInit = () => {
|
|
||||||
// modal
|
// modal
|
||||||
let modal = document.createElement("div");
|
let modal = document.createElement("div");
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
@ -288,6 +286,7 @@ const mailgoTelInit = () => {
|
|||||||
|
|
||||||
// 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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -530,10 +529,17 @@ const isMailgoTel = element =>
|
|||||||
* document.querySelectorAll(
|
* document.querySelectorAll(
|
||||||
* 'a[href^="mailto:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
* 'a[href^="mailto:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||||
* );
|
* );
|
||||||
|
* document.querySelectorAll(
|
||||||
|
* 'a[href^="tel:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||||
|
* );
|
||||||
*/
|
*/
|
||||||
const mailgoCheckRender = event => {
|
const mailgoCheckRender = event => {
|
||||||
// check if the id=mailgo exists in the body
|
// check if the id=mailgo exists in the body
|
||||||
if (!document.contains(getE("mailgo"))) return;
|
if (
|
||||||
|
!document.contains(getE("mailgo")) ||
|
||||||
|
!document.contains(getE("mailgo-tel"))
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
// the path of the event
|
// the path of the event
|
||||||
let path =
|
let path =
|
||||||
@ -605,9 +611,8 @@ const mailgoKeydown = () => {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
// DOMContentLoaded -> mailgoInit and mailgoTelInit (creates the modals)
|
// DOMContentLoaded -> mailgoInit (creates the modals)
|
||||||
document.addEventListener("DOMContentLoaded", mailgoInit);
|
document.addEventListener("DOMContentLoaded", mailgoInit);
|
||||||
document.addEventListener("DOMContentLoaded", mailgoTelInit);
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user