1
0
Fork 0
owenryan.us/source/assets/email.js

16 lines
924 B
JavaScript
Raw Normal View History

2023-05-16 03:59:18 +00:00
// This code de-obfuscates my email and displays it on screen when the button is clicked
// It's not a perfect solution, but it should stop be enough to stop email scraping
// Email encoded in base64. This might be changed in the future to prevent scraping targeting base64 strings
2024-02-06 04:13:57 +00:00
var email = "Y29udGFjdEBvd2Vucnlhbi51cwo=";
2023-05-16 03:59:18 +00:00
document.addEventListener("DOMContentLoaded", function () {
// Get document elements
2024-02-06 04:13:57 +00:00
var button = document.querySelector("#emailButton");
var emailDiv = document.querySelector("#email");
2023-05-16 03:59:18 +00:00
// Decode the email string and insert a mailto link into the DOM, then disable the button
button.addEventListener("click", function () {
2024-02-06 04:13:57 +00:00
var decodedEmail = atob(email);
2023-05-16 03:59:18 +00:00
emailDiv.insertAdjacentHTML("beforeend", "<div class=\"col\"><a href=\"mailto:".concat(decodedEmail, "\"><strong>").concat(decodedEmail, "</strong></a></div>"));
button.disabled = true;
});
});