new data-cc-address, data-cc-domain, data-subject, data-body

This commit is contained in:
Matteo Manzinello 2019-05-13 12:10:57 +02:00
parent 5747e41b3c
commit e07aad3a8a

View File

@ -194,18 +194,33 @@ mailgoRender = mailgo => {
bodyMail = urlParams.get("body");
} else {
// if the element href="#mailgo" or class="mailgo"
// email = data-address + @ + data-domain
// mail = data-address + @ + data-domain
mail =
mailgo.getAttribute("data-address") +
"@" +
mailgo.getAttribute("data-domain");
mailtoHref = MAILTO + encodeURIComponent(mail);
url = new URL(mailtoHref);
// cc = data-cc-address + @ + data-cc-domain
cc =
mailgo.getAttribute("data-cc-address") +
"@" +
mailgo.getAttribute("data-cc-domain");
// subject = data-subject
subject = mailgo.getAttribute("data-subject");
// body = data-body
bodyMail = mailgo.getAttribute("data-body");
}
// validate the email address
if (!validateEmail(mail)) return;
// if cc is not valid cc = ""
if (!validateEmail(cc)) cc = "";
// information
titleEl = getE("mailgo-title");
detailsEl = getE("mailgo-details");
@ -344,13 +359,13 @@ validateEmail = email => {
// copy of a string
copyToClipboard = str => {
const el = document.createElement("textarea");
let el = document.createElement("textarea");
el.value = str;
el.setAttribute("readonly", "");
el.style.position = "absolute";
el.style.left = "-9999px";
document.body.appendChild(el);
const selected =
let selected =
document.getSelection().rangeCount > 0
? document.getSelection().getRangeAt(0)
: false;