added comments, better management of types
This commit is contained in:
parent
776c4627d7
commit
3df5d53a8e
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -448,8 +448,11 @@ const mailgoRender = (type = MAIL_TYPE, mailgo) => {
|
||||
|
||||
// add the actions to buttons
|
||||
waButton.addEventListener("click", () => actions.openWhatsApp());
|
||||
|
||||
telegramButton.addEventListener("click", () => actions.openTelegram());
|
||||
|
||||
callButton.addEventListener("click", () => actions.callDefault());
|
||||
|
||||
copyButton.addEventListener("click", () => actions.copy(tel));
|
||||
}
|
||||
|
||||
@ -582,13 +585,19 @@ const isMailgo = (element, type = MAIL_TYPE) => {
|
||||
|
||||
/**
|
||||
* mailgoCheckRender
|
||||
* function to check if an element is mailgo-enabled or not referencing to the old
|
||||
* function to check if an element is mailgo-enabled or not referencing to
|
||||
* mail:
|
||||
* document.querySelectorAll(
|
||||
* 'a[href^="mailto:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||
* );
|
||||
* tel:
|
||||
* document.querySelectorAll(
|
||||
* 'a[href^="tel:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||
* );
|
||||
* or
|
||||
* document.querySelectorAll(
|
||||
* 'a[href^="callto:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||
* );
|
||||
*/
|
||||
const mailgoCheckRender = event => {
|
||||
// check if the id=mailgo exists in the body
|
||||
@ -706,9 +715,16 @@ document.addEventListener("click", mailgoCheckRender);
|
||||
|
||||
// show the modal
|
||||
const showMailgo = (type = MAIL_TYPE) => {
|
||||
type === TEL_TYPE
|
||||
? setDisplay("mailgo-tel", "flex")
|
||||
: setDisplay("mailgo", "flex");
|
||||
// show mailgo type mail
|
||||
if (type === MAIL_TYPE) {
|
||||
setDisplay("mailgo", "flex");
|
||||
return;
|
||||
}
|
||||
// show mailgo type tel
|
||||
if (type === TEL_TYPE) {
|
||||
setDisplay("mailgo-tel", "flex");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// hide the modal
|
||||
@ -773,7 +789,7 @@ const validateEmail = email => {
|
||||
const validateEmails = arr => arr.every(validateEmail);
|
||||
|
||||
// TODO
|
||||
// clean a telephone number (removes +, - ...)
|
||||
// clean a telephone number (removes - ...)
|
||||
const cleanTel = tel => tel;
|
||||
|
||||
// copy of a string
|
||||
|
Loading…
x
Reference in New Issue
Block a user