From 675ff57c2e1959070ccf0260a74f080f6fb6d383 Mon Sep 17 00:00:00 2001
From: Dante Catalfamo
Date: Fri, 6 Nov 2020 10:24:15 -0500
Subject: About: Email decode script

---
 content/about/email.js  | 12 ++++++++++++
 content/about/index.org |  9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 content/about/email.js

(limited to 'content/about')

diff --git a/content/about/email.js b/content/about/email.js
new file mode 100644
index 0000000..02f3cee
--- /dev/null
+++ b/content/about/email.js
@@ -0,0 +1,12 @@
+"use strict";
+
+function emailDecode() {
+  const emailElement = document.querySelector("code.language-shell");
+  const emailB64 = emailElement.textContent.split('"')[1];
+  const email = atob(emailB64);
+  const mailto = `<a href="mailto:${email}">${email}</a>`;
+  emailElement.outerHTML = mailto;
+}
+
+const emailElement = document.querySelector("code.language-shell");
+emailElement.addEventListener('click', emailDecode);
diff --git a/content/about/index.org b/content/about/index.org
index 57d2cbe..35d0bef 100644
--- a/content/about/index.org
+++ b/content/about/index.org
@@ -40,7 +40,10 @@ I've solved after not being able to find adequate solutions online. I
 figure I'm not the only one who has these problems, so I thought I'd
 share my notes online!
 
-Unless you're a spammer, feel free to contact me at
+Unless you're a spammer, feel free to contact me.
+
+Clicking the code below will automatically decode the address in your
+browser.
 
 #+BEGIN_SRC shell
 echo "ZGFudGVAbGFtYmRhLmN4Cg==" | openssl base64 -d
@@ -48,6 +51,10 @@ echo "ZGFudGVAbGFtYmRhLmN4Cg==" | openssl base64 -d
 
 It's always fun to hear from people!
 
+#+begin_export html
+<script src="email.js"></script>
+#+end_export
+
 #+ATTR_HTML: :title Me Playing A Quick Game Of 9x9 Go
 #+ATTR_HTML: :alt Me Playing A Quick Game Of 9x9 Go
 [[file:cover.jpg]]
-- 
cgit v1.2.3