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