Hi,
Replace the following function in lib.js and let us know if it helped or not:
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag)
{
// find all occurences of the search term in the given text,
// and add some "highlight" tags to them (we're not using a
// regular expression search, because we want to filter out
// matches that occur within HTML tags and script blocks, so
// we have to do a little extra validation)
var newText = "";
var i = 0, j = 0;
var before_c, before_c;
var lcSearchTerm = searchTerm.toLowerCase();
var lcBodyText = bodyText.toLowerCase();
while ((i = lcBodyText.indexOf(lcSearchTerm, i)) > 0) {
before_c = lcBodyText.charCodeAt(i-1);
after_c = lcBodyText.charCodeAt(i+searchTerm.length);
if (lcBodyText.lastIndexOf(">", i) >= lcBodyText.lastIndexOf("<", i)) {
if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
if ( (before_c < 65 || before_c > 122) && (after_c < 65 || after_c > 122) ) {
newText += bodyText.substring(j, i) + highlightStartTag + bodyText.sub
str(i, searchTerm.length) + highlightEndTag;
i += searchTerm.length;
j = i;
continue;
}
}
}
i++;
}
newText += bodyText.substring(j, bodyText.length);
return newText;
}
Best regards.
Frank