diff options
author | V <v@anomalous.eu> | 2021-07-31 03:34:39 +0200 |
---|---|---|
committer | V <v@anomalous.eu> | 2021-07-31 03:34:39 +0200 |
commit | 3ef33c8380d8572ddd6161c9be5c3b8b9bf1e778 (patch) | |
tree | 652abbe5be9ea141e89f6c6ded9134bd0499eb4a | |
parent | b8cb6f333d041f675fd4411eee5d3bf1852efebd (diff) | |
download | email-protected-3ef33c8380d8572ddd6161c9be5c3b8b9bf1e778.tar.zst |
Style/wording nits
-rw-r--r-- | content.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/content.js b/content.js index 4c219b3..1ea1429 100644 --- a/content.js +++ b/content.js @@ -10,19 +10,19 @@ function decodeHtml(str) { return doc.documentElement.textContent } -// decodes a "protected" "email" +// decodes an obfuscated e-mail function decode(data) { const [key, ...encoded] = data.match(/.{2}/g).map(e => parseInt(e, 16)) - const bytes = encoded.map(e => String.fromCharCode(e ^ key)).join("") + const bytes = encoded.map(e => String.fromCharCode(e ^ key)).join('') // not sure why the proprietary code decodes entities, but I'm not changing it return decodeHtml(decodeUtf8(bytes)) } -// processes a document fragment for "protected" "emails" +// processes a document fragment for obfuscated e-mails function process(root) { // mailto links - // format: <a href="/cdn-cgi/l/email-protection#{encrypted data}">...</a> + // format: <a href="/cdn-cgi/l/email-protection#{obfuscated data}">...</a> for (const node of root.querySelectorAll('a')) { try { const url = new URL(node.href) @@ -33,8 +33,8 @@ function process(root) { } } - // everything else Cloudflare thinks is an email - // format: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="{encrypted data}">[email protected]</a> + // everything else Cloudflare thinks is an e-mail + // format: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="{obfuscated data}">[email protected]</a> for (const node of root.querySelectorAll('.__cf_email__')) node.replaceWith(decode(node.getAttribute('data-cfemail'))) |