diff options
author | smege1001 <smege1001@aaathats3as.com> | 2020-07-31 03:37:18 +0100 |
---|---|---|
committer | smege1001 <smege1001@aaathats3as.com> | 2020-07-31 03:37:18 +0100 |
commit | 9e05025a6aa8f998e6617c61233f0529eaa130da (patch) | |
tree | 0b527ea82f5c74b564002cf62fdd7b37ceab7512 | |
parent | 88e388581fb9fedbdf988461ac01830c77a9c1a6 (diff) | |
download | cloudflare-tor-9e05025a6aa8f998e6617c61233f0529eaa130da.tar.lz cloudflare-tor-9e05025a6aa8f998e6617c61233f0529eaa130da.tar.xz cloudflare-tor-9e05025a6aa8f998e6617c61233f0529eaa130da.zip |
text on a child of a link that is email protected bug fixed
-rw-r--r-- | cfemail.user.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cfemail.user.js b/cfemail.user.js index eaf7b13a..24a6d469 100644 --- a/cfemail.user.js +++ b/cfemail.user.js @@ -35,14 +35,26 @@ for (var linksIndex = 0; linksIndex < links.length; linksIndex++) { var link = links[linksIndex]; if (emailprotectionURLHashRegex.test(link.href)) { var hash = link.href.match(emailprotectionURLHashRegex)[1]; - link.href = "mailto:" + decodeEmail(hash); //replace the stupid email protection with just a mailto link + var decodedEmail = decodeEmail(hash); + + link.href = "mailto:" + decodedEmail; //replace the stupid email protection with just a mailto link + + if (link.getElementsByClassName("__cf_email__")) { + var linkChild = link.getElementsByClassName("__cf_email__")[0]; + linkChild.innerText = decodedEmail; + + link.removeAttribute("data-cfemail"); + link.classList.remove("__cf_email__"); + + if (link.getAttribute("class") == "") link.removeAttribute("class"); + } } else if (emailprotectionURLNoHashRegex.test(link.href) && link.hasAttribute("data-cfemail")) { var hash = link.getAttribute("data-cfemail"); var decodedEmail = decodeEmail(hash); link.href = "mailto:" + decodedEmail; link.innerText = decodedEmail; //the inner text is just [email protected] - + //remove the useless attributes link.removeAttribute("data-cfemail"); link.classList.remove("__cf_email__"); |