rem: function highlightWord(node,word,searchwordindex) {  if (node.hasChildNodes) { var hi_cn; for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) { highlightWord(node.childNodes[hi_cn],word,searchwordindex); } }   if (node.nodeType == 3) { tempNodeVal = node.nodeValue.toLowerCase(); tempWordVal = word.toLowerCase(); if (tempNodeVal.indexOf(tempWordVal) != -1) { pn = node.parentNode; if (pn.className.substring(0,10) != "searchword" && pn.className != "result-date") {  nv = node.nodeValue; ni = tempNodeVal.indexOf(tempWordVal);  before = document.createTextNode(nv.substr(0,ni)); docWordVal = nv.substr(ni,word.length); after = document.createTextNode(nv.substr(ni+word.length)); hiwordtext = document.createTextNode(docWordVal); hiword = document.createElement("span"); hiword.className = "searchword"+(searchwordindex % 5); hiword.appendChild(hiwordtext); pn.insertBefore(before,node); pn.insertBefore(hiword,node); pn.insertBefore(after,node); pn.removeChild(node); } } } } 
add: function highlightWord(node, word, searchwordindex) {   if (node.nodeType == 3) { var pos = node.nodeValue.toLowerCase().indexOf(word.toLowerCase()); if (pos >= 0 && !node.parentNode.className.match(/^searchword\d/)) { var span = document.createElement("span"); span.className = "searchword" + (searchwordindex % 5); span.appendChild(document.createTextNode( node.nodeValue.substr(pos, word.length))); var newNode = node.splitText(pos); newNode.nodeValue = newNode.nodeValue.substr(word.length); node.parentNode.insertBefore(span, newNode); } } else {  for (var i = 0; i < node.childNodes.length; i++) { highlightWord(node.childNodes[i], word, searchwordindex); } } } 
context: function highlightWord(node,word,searchwordindex) {	// Iterate into this nodes childNodes	if (node.hasChildNodes) {		var hi_cn;		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {			highlightWord(node.childNodes[hi_cn],word,searchwordindex);		}	}		// And do this node itself	if (node.nodeType == 3) { // text node		tempNodeVal = node.nodeValue.toLowerCase();		tempWordVal = word.toLowerCase();		if (tempNodeVal.indexOf(tempWordVal) != -1) {			pn = node.parentNode;			if (pn.className.substring(0,10) != "searchword" && 			    pn.className != "result-date") {				// word has not already been highlighted!				nv = node.nodeValue;				ni = tempNodeVal.indexOf(tempWordVal);				// Create a load of replacement nodes				before = document.createTextNode(nv.substr(0,ni));				docWordVal = nv.substr(ni,word.length);				after = document.createTextNode(nv.substr(ni+word.length));				hiwordtext = document.createTextNode(docWordVal);				hiword = document.createElement("span");				hiword.className = "searchword"+(searchwordindex % 5);				hiword.appendChild(hiwordtext);				pn.insertBefore(before,node);				pn.insertBefore(hiword,node);				pn.insertBefore(after,node);				pn.removeChild(node);			}		}	}}
meta: 1802	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1802/349955863fb0a923ba748f9c8f1d87fb53f32d1b/trac.js/clean/htdocs/trac.js