changed the behaviour of telegram, now available only with username

This commit is contained in:
Matteo Manzinello 2019-09-19 12:16:29 +02:00
parent 8a900e1e23
commit a186989885

View File

@ -29,7 +29,8 @@ let url = "",
// mailgo tel variables
let tel = "",
msg = "";
msg = "",
telegramUsername = "";
// mailgo buttons
let gmailButton,
@ -230,6 +231,10 @@ const mailgoInit = () => {
telegram.href = "#mailgo-telegram";
telegram.classList.add("mailgo-open");
telegram.classList.add("mailgo-telegram");
// by default not display
telegram.style.display = "none";
let telegramContent = document.createTextNode("open in ");
telegram.appendChild(telegramContent);
let telegramSpan = document.createElement("span");
@ -437,12 +442,21 @@ const mailgoRender = (type = MAIL_TYPE, mailgo) => {
// information
let titleEl = getE("mailgo-tel-title");
// Telegram username
if (mailgo.hasAttribute("data-telegram")) {
telegramUsername = mailgo.getAttribute("data-telegram");
}
// actions
waButton = getE("mailgo-wa");
telegramButton = getE("mailgo-telegram");
callButton = getE("mailgo-call");
copyButton = getE("mailgo-tel-copy");
if (telegramUsername) {
telegramButton.setDisplay("block");
}
// the title of the modal (tel)
titleEl.innerHTML = tel;
@ -508,7 +522,7 @@ const actions = {
openTelegram: () => {
// Telegram url
let tgUrl = "https://t.me/" + tel;
let tgUrl = "https://t.me/" + telegramUsername;
// open the url
window.open(tgUrl, "_blank");
// hide the modal