From 3ef33c8380d8572ddd6161c9be5c3b8b9bf1e778 Mon Sep 17 00:00:00 2001 From: V Date: Sat, 31 Jul 2021 03:34:39 +0200 Subject: Style/wording nits --- content.js | 12 ++++++------ 1 file 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: ... + // format: ... 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: [email protected] + // everything else Cloudflare thinks is an e-mail + // format: [email protected] for (const node of root.querySelectorAll('.__cf_email__')) node.replaceWith(decode(node.getAttribute('data-cfemail'))) -- cgit 1.4.1