From 3af6d9131f6dfc138856d718ec96626344095ec8 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 23:24:44 -0700 Subject: Optimizations and Fixes --- static/js/email.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 static/js/email.js (limited to 'static/js/email.js') diff --git a/static/js/email.js b/static/js/email.js new file mode 100644 index 0000000..01e338a --- /dev/null +++ b/static/js/email.js @@ -0,0 +1,16 @@ +(function() { + // Find all the elements on the page that use class="m-protected" + var allElements = document.getElementsByClassName('m-protected'); + + // Loop through all the elements, and update them + for (var i = 0; i < allElements.length; i++) { + // fetch the hex-encoded string from the href property + var encoded = allElements[i].getAttribute('href'); + + // decode the email address + var decoded = atob(encoded.substring(1)); + + // Set the link to be a "mailto:" link + allElements[i].href = 'mailto:' + decoded; + } +})(); -- cgit v1.3.1