aggiunta funzionalità di encrypt email (da testare)

This commit is contained in:
Matteo Manzinello
2019-05-09 09:16:31 +02:00
parent 7e2787ad32
commit 5ed27a17e3
2 changed files with 23 additions and 20 deletions

View File

@@ -156,7 +156,17 @@ mailgoInit = () => {
// open default
let open = document.createElement("a");
open.href = mailtoHref;
open.href = "#mailgo-open";
let encEmail = encryptEmail(mail);
open.addEventListener(
"click",
() => {
mailToEncoded(encEmail);
},
false
);
open.classList.add("mailgo-open");
open.classList.add("mailgo-weight-500");
let openContent = document.createTextNode("open");
@@ -248,3 +258,14 @@ copyToClipboard = str => {
document.getSelection().addRange(selected);
}
};
// decrypt email
function mailToEncoded(encoded) {
var address = atob(encoded);
window.location.href = "mailto:" + address;
}
// encrypt email
function encryptEmail(email) {
return btoa(email);
}