fix for highlighting searched words in snippets

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2564 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent b251076e64
commit 6e03f61daa

@ -41,6 +41,27 @@ function handleState(req) {
//span.setAttribute("class", "snippetError");
}
var snippetNode = document.createTextNode(snippetText);
span.appendChild(snippetNode);
var pos=snippetText.indexOf("<b>");
var pos2=snippetText.indexOf("</b>");
var tmpNode=null;
var tmpNode2=null;
while(pos >= 0 && pos2 > pos){
tmpNode = document.createTextNode(snippetText.substring(0, pos); //other text
if(tmpNode != ""){
span.appendChild(tmpNode);
}
//add the bold text
tmpNode=document.createElement("strong")
tmpNode2=document.createTextNode(snippetText.substring(pos+3,pos2);
tmpNode.append(tmpNode2);
span.appendChild(tmpNode)
snippetText=substring(pos2+4)
var pos=snippetText.indexOf("<b>");
var pos2=snippetText.indexOf("</b>");
}
if(snippetText != ""){
tmpNode = document.createTextNode(snippetText.substring(0, pos); //other text
span.appendChild(tmpNode);
}
}

Loading…
Cancel
Save