removed obj actions
This commit is contained in:
parent
08ce4c434b
commit
09e57d1730
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -392,7 +392,7 @@
|
|||||||
let bodyEl = getE("mailgo-body");
|
let bodyEl = getE("mailgo-body");
|
||||||
let bodyValueEl = getE("mailgo-body-value");
|
let bodyValueEl = getE("mailgo-body-value");
|
||||||
|
|
||||||
// actions
|
// action buttons
|
||||||
gmailButton = getE("mailgo-gmail");
|
gmailButton = getE("mailgo-gmail");
|
||||||
outlookButton = getE("mailgo-outlook");
|
outlookButton = getE("mailgo-outlook");
|
||||||
openButton = getE("mailgo-open");
|
openButton = getE("mailgo-open");
|
||||||
@ -423,14 +423,14 @@
|
|||||||
: (bodyEl.style.display = "none");
|
: (bodyEl.style.display = "none");
|
||||||
|
|
||||||
// add the actions
|
// add the actions
|
||||||
gmailButton.addEventListener("click", () => actions.openGmail());
|
gmailButton.addEventListener("click", () => openGmail());
|
||||||
|
|
||||||
outlookButton.addEventListener("click", () => actions.openOutlook());
|
outlookButton.addEventListener("click", () => openOutlook());
|
||||||
|
|
||||||
encEmail = encodeEmail(mail);
|
encEmail = encodeEmail(mail);
|
||||||
openButton.addEventListener("click", () => actions.openDefault());
|
openButton.addEventListener("click", () => openDefault());
|
||||||
|
|
||||||
copyButton.addEventListener("click", () => actions.copy(mail || tel));
|
copyButton.addEventListener("click", () => copy(mail || tel));
|
||||||
}
|
}
|
||||||
// mailgo tel
|
// mailgo tel
|
||||||
if (type === TEL_TYPE) {
|
if (type === TEL_TYPE) {
|
||||||
@ -477,18 +477,18 @@
|
|||||||
titleEl.innerHTML = tel;
|
titleEl.innerHTML = tel;
|
||||||
|
|
||||||
// add the actions to buttons
|
// add the actions to buttons
|
||||||
waButton.addEventListener("click", () => actions.openWhatsApp());
|
waButton.addEventListener("click", () => openWhatsApp());
|
||||||
|
|
||||||
if (telegramUsername) {
|
if (telegramUsername) {
|
||||||
setDisplay("mailgo-telegram", "block");
|
setDisplay("mailgo-telegram", "block");
|
||||||
telegramButton.addEventListener("click", () => actions.openTelegram());
|
telegramButton.addEventListener("click", () => openTelegram());
|
||||||
}
|
}
|
||||||
|
|
||||||
skypeButton.addEventListener("click", () => actions.openSkype());
|
skypeButton.addEventListener("click", () => openSkype());
|
||||||
|
|
||||||
callButton.addEventListener("click", () => actions.callDefault());
|
callButton.addEventListener("click", () => callDefault());
|
||||||
|
|
||||||
copyButton.addEventListener("click", () => actions.copy(tel));
|
copyButton.addEventListener("click", () => copy(tel));
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the mailgo
|
// show the mailgo
|
||||||
@ -499,8 +499,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
const actions = {
|
openGmail = () => {
|
||||||
openGmail: () => {
|
|
||||||
// Gmail url
|
// Gmail url
|
||||||
let gmailUrl =
|
let gmailUrl =
|
||||||
"https://mail.google.com/mail/u/0/?view=cm&source=mailto&to=" +
|
"https://mail.google.com/mail/u/0/?view=cm&source=mailto&to=" +
|
||||||
@ -517,9 +516,9 @@
|
|||||||
|
|
||||||
// hide the modal
|
// hide the modal
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
openOutlook: () => {
|
openOutlook = () => {
|
||||||
// Outlook url
|
// Outlook url
|
||||||
let outlookUrl =
|
let outlookUrl =
|
||||||
"https://outlook.live.com/owa/?path=/mail/action/compose&to=" +
|
"https://outlook.live.com/owa/?path=/mail/action/compose&to=" +
|
||||||
@ -534,14 +533,14 @@
|
|||||||
|
|
||||||
// hide the modal
|
// hide the modal
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
openDefault: () => {
|
openDefault = () => {
|
||||||
mailToEncoded(encEmail);
|
mailToEncoded(encEmail);
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
openTelegram: () => {
|
openTelegram = () => {
|
||||||
// Telegram url
|
// Telegram url
|
||||||
let tgUrl = "https://t.me/" + telegramUsername;
|
let tgUrl = "https://t.me/" + telegramUsername;
|
||||||
|
|
||||||
@ -550,9 +549,9 @@
|
|||||||
|
|
||||||
// hide the modal
|
// hide the modal
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
openSkype: () => {
|
openSkype = () => {
|
||||||
let skype = skypeUsername !== "" ? skypeUsername : tel;
|
let skype = skypeUsername !== "" ? skypeUsername : tel;
|
||||||
|
|
||||||
// Telegram url
|
// Telegram url
|
||||||
@ -563,9 +562,9 @@
|
|||||||
|
|
||||||
// hide the modal
|
// hide the modal
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
openWhatsApp: () => {
|
openWhatsApp = () => {
|
||||||
// WhatsApp url
|
// WhatsApp url
|
||||||
let waUrl = "https://wa.me/" + tel;
|
let waUrl = "https://wa.me/" + tel;
|
||||||
|
|
||||||
@ -577,15 +576,15 @@
|
|||||||
|
|
||||||
// hide the modal
|
// hide the modal
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
callDefault: () => {
|
callDefault = () => {
|
||||||
let callUrl = "tel:" + tel;
|
let callUrl = "tel:" + tel;
|
||||||
window.open(callUrl);
|
window.open(callUrl);
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
},
|
};
|
||||||
|
|
||||||
copy: content => {
|
copy = content => {
|
||||||
copyToClipboard(content);
|
copyToClipboard(content);
|
||||||
// the correct copyButton (mail or tel)
|
// the correct copyButton (mail or tel)
|
||||||
mailgoIsShowing(MAIL_TYPE)
|
mailgoIsShowing(MAIL_TYPE)
|
||||||
@ -597,7 +596,6 @@
|
|||||||
// hide after the timeout
|
// hide after the timeout
|
||||||
hideMailgo();
|
hideMailgo();
|
||||||
}, 999);
|
}, 999);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// function that returns if an element is a mailgo
|
// function that returns if an element is a mailgo
|
||||||
@ -715,20 +713,20 @@
|
|||||||
break;
|
break;
|
||||||
case 71:
|
case 71:
|
||||||
// g -> open GMail
|
// g -> open GMail
|
||||||
actions.openGmail();
|
openGmail();
|
||||||
break;
|
break;
|
||||||
case 79:
|
case 79:
|
||||||
// o -> open Outlook
|
// o -> open Outlook
|
||||||
actions.openOutlook();
|
openOutlook();
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
case 13:
|
case 13:
|
||||||
// spacebar or enter -> open default
|
// spacebar or enter -> open default
|
||||||
actions.openDefault();
|
openDefault();
|
||||||
break;
|
break;
|
||||||
case 67:
|
case 67:
|
||||||
// c -> copy
|
// c -> copy
|
||||||
actions.copy(mail);
|
copy(mail);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -741,20 +739,20 @@
|
|||||||
break;
|
break;
|
||||||
case 84:
|
case 84:
|
||||||
// t -> open Telegram
|
// t -> open Telegram
|
||||||
actions.openTelegram();
|
openTelegram();
|
||||||
break;
|
break;
|
||||||
case 87:
|
case 87:
|
||||||
// w -> open WhatsApp
|
// w -> open WhatsApp
|
||||||
actions.openWhatsApp();
|
openWhatsApp();
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
case 13:
|
case 13:
|
||||||
// spacebar or enter -> call default
|
// spacebar or enter -> call default
|
||||||
actions.callDefault();
|
callDefault();
|
||||||
break;
|
break;
|
||||||
case 67:
|
case 67:
|
||||||
// c -> copy
|
// c -> copy
|
||||||
actions.copy(tel);
|
copy(tel);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user