Skip to content

Instantly share code, notes, and snippets.

@mshirdel
Forked from siwells/gist:1114395
Last active August 29, 2015 14:21
Show Gist options
  • Save mshirdel/6b5b8779d1b0882c5501 to your computer and use it in GitHub Desktop.
Save mshirdel/6b5b8779d1b0882c5501 to your computer and use it in GitHub Desktop.
RegEx for replacing font tag
/*
* Clear the highlighting to allow the user to toggle
* between the original page & the highlighted page.
*/
function clearHighlighting()
{
alert("clearing hightlighting...");
if (!document.body || typeof(document.body.innerHTML) == "undefined") {
if (warnOnFailure) {
alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
}
return false;
}
var re = new RegExp('<'+'font'+'[^><]*>|<.'+'font'+'[^><]*>','g')
var bodyText = document.body.innerHTML;
bodyText = bodyText.replace(re, '');
document.body.innerHTML = bodyText;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment