more export
This commit is contained in:
parent
63de5957d7
commit
cd0f047ac0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -553,7 +553,7 @@ var mailgo_mailgoInit = function mailgoInit() {
|
|||
*/
|
||||
|
||||
|
||||
var mailgoRender = function mailgoRender() {
|
||||
function mailgoRender() {
|
||||
var _config7;
|
||||
|
||||
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MAIL_TYPE;
|
||||
|
@ -586,8 +586,7 @@ var mailgoRender = function mailgoRender() {
|
|||
subject = mailgoElement.getAttribute("data-subject"); // body = data-body
|
||||
|
||||
bodyMail = mailgoElement.getAttribute("data-body");
|
||||
} // TODO test this
|
||||
|
||||
}
|
||||
|
||||
if (typeof ((_config5 = config) === null || _config5 === void 0 ? void 0 : _config5.validateEmail) === "undefined" || ((_config6 = config) === null || _config6 === void 0 ? void 0 : _config6.validateEmail) === true) {
|
||||
// validate the email address
|
||||
|
@ -670,8 +669,7 @@ var mailgoRender = function mailgoRender() {
|
|||
showMailgo(type); // add listener keyDown
|
||||
|
||||
document.addEventListener("keydown", mailgoKeydown);
|
||||
}; // actions
|
||||
|
||||
} // actions
|
||||
|
||||
var openGmail = function openGmail() {
|
||||
// Gmail url
|
||||
|
@ -754,7 +752,7 @@ var copy = function copy(content) {
|
|||
}; // function that returns if an element is a mailgo
|
||||
|
||||
|
||||
var isMailgo = function isMailgo(element) {
|
||||
function isMailgo(element) {
|
||||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAIL_TYPE;
|
||||
var href = element.href; // mailgo type mail
|
||||
|
||||
|
@ -776,7 +774,7 @@ var isMailgo = function isMailgo(element) {
|
|||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* mailgoCheckRender
|
||||
* function to check if an element is mailgo-enabled or not referencing to
|
||||
|
@ -794,8 +792,7 @@ var isMailgo = function isMailgo(element) {
|
|||
* );
|
||||
*/
|
||||
|
||||
|
||||
var mailgoCheckRender = function mailgoCheckRender(event) {
|
||||
function mailgoCheckRender(event) {
|
||||
// check if the id=mailgo exists in the body
|
||||
if (!document.contains(modalMailto) || !document.contains(modalTel)) return false; // if a mailgo is already showing do nothing
|
||||
|
||||
|
@ -826,13 +823,12 @@ var mailgoCheckRender = function mailgoCheckRender(event) {
|
|||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* mailgoKeydown
|
||||
* function to manage the keydown event when the modal is showing
|
||||
*/
|
||||
|
||||
|
||||
var mailgoKeydown = function mailgoKeydown(keyboardEvent) {
|
||||
// if mailgo is showing
|
||||
if (mailgoIsShowing(MAIL_TYPE)) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -46,5 +46,14 @@ declare module "mailgo" {
|
|||
passive?: boolean;
|
||||
};
|
||||
|
||||
export function mailgoRender(
|
||||
type: string,
|
||||
mailgoElement: HTMLLinkElement
|
||||
): void;
|
||||
|
||||
export function isMailgo(element: HTMLElement, type?: string): boolean;
|
||||
|
||||
export function mailgoCheckRender(event: Event): boolean;
|
||||
|
||||
export default function mailgo(mailgoConfig?: MailgoConfig): void;
|
||||
}
|
||||
|
|
|
@ -392,10 +392,10 @@ const mailgoInit = (): void => {
|
|||
* mailgoRender
|
||||
* function to render a mailgo (mail or tel)
|
||||
*/
|
||||
const mailgoRender = (
|
||||
type = MAIL_TYPE,
|
||||
export function mailgoRender(
|
||||
type: string = MAIL_TYPE,
|
||||
mailgoElement: HTMLLinkElement
|
||||
): void => {
|
||||
): void {
|
||||
// mailgo mail
|
||||
if (type === MAIL_TYPE) {
|
||||
// if the element href=^"mailto:"
|
||||
|
@ -444,7 +444,6 @@ const mailgoRender = (
|
|||
bodyMail = mailgoElement.getAttribute("data-body");
|
||||
}
|
||||
|
||||
// TODO test this
|
||||
if (
|
||||
typeof config?.validateEmail === "undefined" ||
|
||||
config?.validateEmail === true
|
||||
|
@ -563,7 +562,7 @@ const mailgoRender = (
|
|||
|
||||
// add listener keyDown
|
||||
document.addEventListener("keydown", mailgoKeydown);
|
||||
};
|
||||
}
|
||||
|
||||
// actions
|
||||
const openGmail = (): void => {
|
||||
|
@ -665,7 +664,10 @@ const copy = (content: string): void => {
|
|||
};
|
||||
|
||||
// function that returns if an element is a mailgo
|
||||
const isMailgo = (element: HTMLElement, type: string = MAIL_TYPE): boolean => {
|
||||
export function isMailgo(
|
||||
element: HTMLElement,
|
||||
type: string = MAIL_TYPE
|
||||
): boolean {
|
||||
let href: string = (element as HTMLLinkElement).href;
|
||||
|
||||
// mailgo type mail
|
||||
|
@ -701,7 +703,7 @@ const isMailgo = (element: HTMLElement, type: string = MAIL_TYPE): boolean => {
|
|||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* mailgoCheckRender
|
||||
|
@ -719,7 +721,7 @@ const isMailgo = (element: HTMLElement, type: string = MAIL_TYPE): boolean => {
|
|||
* 'a[href^="callto:" i]:not(.no-mailgo), a[href="#mailgo"], a.mailgo'
|
||||
* );
|
||||
*/
|
||||
const mailgoCheckRender = (event: Event): boolean => {
|
||||
export function mailgoCheckRender(event: Event): boolean {
|
||||
// check if the id=mailgo exists in the body
|
||||
if (!document.contains(modalMailto) || !document.contains(modalTel))
|
||||
return false;
|
||||
|
@ -760,7 +762,7 @@ const mailgoCheckRender = (event: Event): boolean => {
|
|||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* mailgoKeydown
|
||||
|
|
Loading…
Reference in New Issue