fixed a bug with telegram button

This commit is contained in:
Matteo Manzinello 2020-07-16 13:24:51 +02:00
parent bce64e879a
commit fcbe3af4e0
7 changed files with 16 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -626,6 +626,8 @@ var mailgoRender = function mailgoRender() {
if (mailgo.hasAttribute("data-telegram")) {
telegramUsername = mailgo.getAttribute("data-telegram");
} else {
telegramUsername = null;
} // Telegram username
@ -636,11 +638,13 @@ var mailgoRender = function mailgoRender() {
titleTel.innerHTML = tel; // add the actions to buttons
wa.addEventListener("click", openWhatsApp);
wa.addEventListener("click", openWhatsApp); // telegram must be shown only if data-telegram is provided
if (telegramUsername) {
setDisplay("m-tg", "block");
telegram.addEventListener("click", openTelegram);
} else {
setDisplay("m-tg", "none");
}
skype.addEventListener("click", openSkype);
@ -1032,6 +1036,7 @@ var mailgoStyle = function mailgoStyle() {
// mailgo style
var mailgoCSSElement = createElement("style");
mailgoCSSElement.id = "mailgo-style";
mailgoCSSElement.type = "text/css";
mailgoCSSElement.appendChild(createTextNode(mailgoCSS));
document.head.appendChild(mailgoCSSElement);
}; // mailgo

File diff suppressed because one or more lines are too long

View File

@ -503,6 +503,8 @@ const mailgoRender = (type = MAIL_TYPE, mailgo: HTMLLinkElement): void => {
// Telegram username
if (mailgo.hasAttribute("data-telegram")) {
telegramUsername = mailgo.getAttribute("data-telegram");
} else {
telegramUsername = null;
}
// Telegram username
@ -516,9 +518,12 @@ const mailgoRender = (type = MAIL_TYPE, mailgo: HTMLLinkElement): void => {
// add the actions to buttons
wa.addEventListener("click", openWhatsApp);
// telegram must be shown only if data-telegram is provided
if (telegramUsername) {
setDisplay("m-tg", "block");
telegram.addEventListener("click", openTelegram);
} else {
setDisplay("m-tg", "none");
}
skype.addEventListener("click", openSkype);