better ts
This commit is contained in:
parent
ab8cbe7a71
commit
8293ceac5e
@ -132,7 +132,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(details);
|
modalContent.appendChild(details);
|
||||||
|
|
||||||
// Gmail
|
// Gmail
|
||||||
gmail = <HTMLLinkElement>createElement("a");
|
gmail = createElement("a") as HTMLLinkElement;
|
||||||
gmail.id = "m-gmail";
|
gmail.id = "m-gmail";
|
||||||
gmail.href = DEFAULT_BTN_HREF;
|
gmail.href = DEFAULT_BTN_HREF;
|
||||||
gmail.classList.add("m-open");
|
gmail.classList.add("m-open");
|
||||||
@ -146,7 +146,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(gmail);
|
modalContent.appendChild(gmail);
|
||||||
|
|
||||||
// Outlook
|
// Outlook
|
||||||
outlook = <HTMLLinkElement>createElement("a");
|
outlook = createElement("a") as HTMLLinkElement;
|
||||||
outlook.id = "m-outlook";
|
outlook.id = "m-outlook";
|
||||||
outlook.href = DEFAULT_BTN_HREF;
|
outlook.href = DEFAULT_BTN_HREF;
|
||||||
outlook.classList.add("m-open");
|
outlook.classList.add("m-open");
|
||||||
@ -160,7 +160,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(outlook);
|
modalContent.appendChild(outlook);
|
||||||
|
|
||||||
// open default
|
// open default
|
||||||
open = <HTMLLinkElement>createElement("a");
|
open = createElement("a") as HTMLLinkElement;
|
||||||
open.id = "m-open";
|
open.id = "m-open";
|
||||||
open.href = DEFAULT_BTN_HREF;
|
open.href = DEFAULT_BTN_HREF;
|
||||||
open.classList.add("m-open");
|
open.classList.add("m-open");
|
||||||
@ -174,7 +174,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(open);
|
modalContent.appendChild(open);
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
copyMail = <HTMLLinkElement>createElement("a");
|
copyMail = createElement("a") as HTMLLinkElement;
|
||||||
copyMail.id = "m-copy";
|
copyMail.id = "m-copy";
|
||||||
copyMail.href = DEFAULT_BTN_HREF;
|
copyMail.href = DEFAULT_BTN_HREF;
|
||||||
copyMail.classList.add("m-copy");
|
copyMail.classList.add("m-copy");
|
||||||
@ -216,7 +216,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(titleTel);
|
modalContent.appendChild(titleTel);
|
||||||
|
|
||||||
// Telegram
|
// Telegram
|
||||||
telegram = <HTMLLinkElement>createElement("a");
|
telegram = createElement("a") as HTMLLinkElement;
|
||||||
telegram.id = "m-tg";
|
telegram.id = "m-tg";
|
||||||
telegram.href = DEFAULT_BTN_HREF;
|
telegram.href = DEFAULT_BTN_HREF;
|
||||||
telegram.classList.add("m-open");
|
telegram.classList.add("m-open");
|
||||||
@ -234,7 +234,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(telegram);
|
modalContent.appendChild(telegram);
|
||||||
|
|
||||||
// WhatsApp
|
// WhatsApp
|
||||||
wa = <HTMLLinkElement>createElement("a");
|
wa = createElement("a") as HTMLLinkElement;
|
||||||
wa.id = "m-wa";
|
wa.id = "m-wa";
|
||||||
wa.href = DEFAULT_BTN_HREF;
|
wa.href = DEFAULT_BTN_HREF;
|
||||||
wa.classList.add("m-open");
|
wa.classList.add("m-open");
|
||||||
@ -248,7 +248,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(wa);
|
modalContent.appendChild(wa);
|
||||||
|
|
||||||
// Skype
|
// Skype
|
||||||
skype = <HTMLLinkElement>createElement("a");
|
skype = createElement("a") as HTMLLinkElement;
|
||||||
skype.id = "m-skype";
|
skype.id = "m-skype";
|
||||||
skype.href = DEFAULT_BTN_HREF;
|
skype.href = DEFAULT_BTN_HREF;
|
||||||
skype.classList.add("m-open");
|
skype.classList.add("m-open");
|
||||||
@ -262,7 +262,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(skype);
|
modalContent.appendChild(skype);
|
||||||
|
|
||||||
// call default
|
// call default
|
||||||
call = <HTMLLinkElement>createElement("a");
|
call = createElement("a") as HTMLLinkElement;
|
||||||
call.id = "m-call";
|
call.id = "m-call";
|
||||||
call.href = DEFAULT_BTN_HREF;
|
call.href = DEFAULT_BTN_HREF;
|
||||||
call.classList.add("m-open");
|
call.classList.add("m-open");
|
||||||
@ -276,7 +276,7 @@ const mailgoInit = (): void => {
|
|||||||
modalContent.appendChild(call);
|
modalContent.appendChild(call);
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
copyTel = <HTMLLinkElement>createElement("a");
|
copyTel = createElement("a") as HTMLLinkElement;
|
||||||
copyTel.id = "m-tel-copy";
|
copyTel.id = "m-tel-copy";
|
||||||
copyTel.href = DEFAULT_BTN_HREF;
|
copyTel.href = DEFAULT_BTN_HREF;
|
||||||
copyTel.classList.add("m-copy");
|
copyTel.classList.add("m-copy");
|
||||||
@ -299,7 +299,7 @@ const mailgoInit = (): void => {
|
|||||||
* mailgoRender
|
* mailgoRender
|
||||||
* function to render a mailgo (mail or tel)
|
* function to render a mailgo (mail or tel)
|
||||||
*/
|
*/
|
||||||
const mailgoRender = (type = MAIL_TYPE, mailgo: any): void => {
|
const mailgoRender = (type = MAIL_TYPE, mailgo: HTMLLinkElement): void => {
|
||||||
// mailgo mail
|
// mailgo mail
|
||||||
if (type === MAIL_TYPE) {
|
if (type === MAIL_TYPE) {
|
||||||
// if the element href=^"mailto:"
|
// if the element href=^"mailto:"
|
||||||
@ -618,7 +618,7 @@ const mailgoCheckRender = (event: Event): boolean => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// render mailgo
|
// render mailgo
|
||||||
mailgoRender(MAIL_TYPE, element);
|
mailgoRender(MAIL_TYPE, element as HTMLLinkElement);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -627,7 +627,7 @@ const mailgoCheckRender = (event: Event): boolean => {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// render mailgo
|
// render mailgo
|
||||||
mailgoRender(TEL_TYPE, element);
|
mailgoRender(TEL_TYPE, element as HTMLLinkElement);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -734,7 +734,7 @@ const mailgoIsShowing = (type = MAIL_TYPE): boolean => {
|
|||||||
|
|
||||||
const byElement = (): HTMLLinkElement => {
|
const byElement = (): HTMLLinkElement => {
|
||||||
// by
|
// by
|
||||||
let by: HTMLLinkElement = <HTMLLinkElement>createElement("a");
|
let by: HTMLLinkElement = createElement("a") as HTMLLinkElement;
|
||||||
by.href = "https://mailgo.js.org?ref=mailgo-modal";
|
by.href = "https://mailgo.js.org?ref=mailgo-modal";
|
||||||
by.className = "m-by";
|
by.className = "m-by";
|
||||||
by.target = "_blank";
|
by.target = "_blank";
|
||||||
@ -799,7 +799,7 @@ const validateEmails = (arr: string[]): boolean => arr.every(validateEmail);
|
|||||||
|
|
||||||
// copy of a string
|
// copy of a string
|
||||||
const copyToClipboard = (str: string): boolean => {
|
const copyToClipboard = (str: string): boolean => {
|
||||||
let el: HTMLInputElement = <HTMLInputElement>createElement("textarea");
|
let el: HTMLInputElement = createElement("textarea") as HTMLInputElement;
|
||||||
el.value = str;
|
el.value = str;
|
||||||
el.setAttribute("readonly", "");
|
el.setAttribute("readonly", "");
|
||||||
el.style.position = "absolute";
|
el.style.position = "absolute";
|
||||||
@ -822,7 +822,7 @@ const copyToClipboard = (str: string): boolean => {
|
|||||||
|
|
||||||
const mailgoStyle = (): void => {
|
const mailgoStyle = (): void => {
|
||||||
// mailgo style
|
// mailgo style
|
||||||
let mailgoCSS: HTMLStyleElement = <HTMLStyleElement>createElement("style");
|
let mailgoCSS: HTMLStyleElement = createElement("style") as HTMLStyleElement;
|
||||||
mailgoCSS.id = "mailgo-style";
|
mailgoCSS.id = "mailgo-style";
|
||||||
mailgoCSS.type = "text/css";
|
mailgoCSS.type = "text/css";
|
||||||
mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`));
|
mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user