aboutsummaryrefslogtreecommitdiffstats
path: root/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.js')
-rw-r--r--main.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.js b/main.js
index 93edd14..9840746 100644
--- a/main.js
+++ b/main.js
@@ -483,12 +483,12 @@ if (window.location === window.parent.location) {
};
/* de-obfuscate email address */
- const MAILTO = 'mailto:';
const CLASSNAME = 'email-address-b64';
+ const ATTRNAME = 'data-mailto-b64';
for (const a of panel.getElementsByClassName(CLASSNAME)) {
- if (a.tagName.toLowerCase() === 'a' && a.href.toLowerCase().startsWith(MAILTO)) {
- let href = MAILTO;
- for (const part of a.href.substr(MAILTO.length).split(/\s+/)) {
+ if (a.tagName.toLowerCase() === 'a' && a.hasAttribute(ATTRNAME)) {
+ let href = 'mailto:';
+ for (const part of a.getAttribute(ATTRNAME).split(/\s+/)) {
switch (part) {
case '__AT__':
href += '@';
@@ -500,8 +500,9 @@ if (window.location === window.parent.location) {
href += atob(part);
}
}
- a.href = href;
a.classList.remove(CLASSNAME);
+ a.removeAttribute(ATTRNAME);
+ a.href = href;
}
}