26 lines
595 B
JavaScript
26 lines
595 B
JavaScript
function obfuscateEmail(item) {
|
|
let href = item.href;
|
|
let innerHTML = item.innerHTML;
|
|
item.onmouseover = (_this) => {
|
|
const elt = _this.target;
|
|
const b64email = elt.href.match('[^/]*$').pop();
|
|
elt.href = 'mailto:' + atob(b64email);
|
|
elt.innerHTML = 'E-mail: ' + atob(b64email);
|
|
}
|
|
item.onmouseout = (_this) => {
|
|
_this.target.href = href;
|
|
_this.target.innerHTML = innerHTML;
|
|
}
|
|
|
|
}
|
|
|
|
function init() {
|
|
const elts = []
|
|
const query = document.getElementsByClassName("obfuscated_email")
|
|
for (let i = 0; i < query.length; i++) {
|
|
obfuscateEmail(query[i]);
|
|
}
|
|
}
|
|
|
|
window.onload = init
|