go on with tel
This commit is contained in:
parent
1080b180c3
commit
bf1484a2a0
@ -29,9 +29,11 @@ document.head.appendChild(mailgoCSS);
|
||||
|
||||
/**
|
||||
* mailgoInit
|
||||
* the function that creates the mailgo element in DOM
|
||||
* the function that creates the mailgo elements in DOM
|
||||
*/
|
||||
const mailgoInit = () => {
|
||||
// mailgo mail
|
||||
{
|
||||
// modal
|
||||
let modal = document.createElement("div");
|
||||
modal.style.display = "none";
|
||||
@ -184,13 +186,9 @@ const mailgoInit = () => {
|
||||
|
||||
// every click outside the modal will hide the modal
|
||||
modalBackground.addEventListener("click", hideMailgo);
|
||||
};
|
||||
|
||||
/**
|
||||
* mailgoTelInit
|
||||
* the function that creates the mailgo (for tel:) element in DOM
|
||||
*/
|
||||
const mailgoTelInit = () => {
|
||||
}
|
||||
// mailgo tel
|
||||
{
|
||||
// modal
|
||||
let modal = document.createElement("div");
|
||||
modal.style.display = "none";
|
||||
@ -288,6 +286,7 @@ const mailgoTelInit = () => {
|
||||
|
||||
// every click outside the modal will hide the modal
|
||||
modalBackground.addEventListener("click", hideMailgo);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -530,10 +529,17 @@ const isMailgoTel = element =>
|
||||
* document.querySelectorAll(
|
||||
* '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 => {
|
||||
// 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
|
||||
let path =
|
||||
@ -605,9 +611,8 @@ const mailgoKeydown = () => {
|
||||
return;
|
||||
};
|
||||
|
||||
// DOMContentLoaded -> mailgoInit and mailgoTelInit (creates the modals)
|
||||
// DOMContentLoaded -> mailgoInit (creates the modals)
|
||||
document.addEventListener("DOMContentLoaded", mailgoInit);
|
||||
document.addEventListener("DOMContentLoaded", mailgoTelInit);
|
||||
|
||||
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||
document.addEventListener("click", mailgoCheckRender);
|
||||
|
Loading…
x
Reference in New Issue
Block a user