mylloon.fr/static/js/mail_obfuscation.js

22 lines
542 B
JavaScript
Raw Normal View History

2024-05-03 12:49:50 +02:00
window.addEventListener("load", () => {
Array.from(document.getElementsByClassName("at")).forEach((elem) => {
2024-06-02 18:44:57 +02:00
const a = elem.parentElement;
const span = elem.previousElementSibling;
2024-06-02 18:19:58 +02:00
// Replace (at) by @
elem.outerHTML = "@";
// Correct text
2024-06-02 18:44:57 +02:00
const data = span.getAttribute("title");
if (data.length > 0) {
a.innerHTML = data;
} else {
a.style = "hyphens: none;";
}
2024-05-29 20:51:04 +02:00
// Change link
2024-06-02 18:53:40 +02:00
const href = a.getAttribute("href");
a.setAttribute("href", href.replace(" at ", "@"));
2024-05-03 12:49:50 +02:00
});
});