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