text on a child of a link that is email protected bug fixed

This commit is contained in:
smege1001 2020-07-31 03:37:18 +01:00
parent 88e388581f
commit 9e05025a6a
1 changed files with 14 additions and 2 deletions

View File

@ -35,7 +35,19 @@ for (var linksIndex = 0; linksIndex < links.length; linksIndex++) {
var link = links[linksIndex]; var link = links[linksIndex];
if (emailprotectionURLHashRegex.test(link.href)) { if (emailprotectionURLHashRegex.test(link.href)) {
var hash = link.href.match(emailprotectionURLHashRegex)[1]; 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")) { } else if (emailprotectionURLNoHashRegex.test(link.href) && link.hasAttribute("data-cfemail")) {
var hash = link.getAttribute("data-cfemail"); var hash = link.getAttribute("data-cfemail");
var decodedEmail = decodeEmail(hash); var decodedEmail = decodeEmail(hash);