From 5a8b06a8515f6e87105ba129cd0c78ae58014642 Mon Sep 17 00:00:00 2001 From: allo Date: Sat, 11 Feb 2006 12:52:49 +0000 Subject: [PATCH] fixing JS-Errors git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1606 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/js/WatchCrawler.js | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/htroot/js/WatchCrawler.js b/htroot/js/WatchCrawler.js index 78ea25743..ff1ff36dd 100644 --- a/htroot/js/WatchCrawler.js +++ b/htroot/js/WatchCrawler.js @@ -1,6 +1,7 @@ DELETE_STRING="delete" var statusRPC; +var indexingQueueRPC; function requestStatus(){ statusRPC=createRequestObject() statusRPC.open('get', '/xml/status_p.xml'); @@ -23,6 +24,9 @@ window.setInterval("requestIndexingQueue()", 5000); function handleStatus(){ + if(statusRPC.readyState != 4){ + return; + } var statusResponse = statusRPC.responseXML; indexingqueue=statusResponse.getElementsByTagName("indexingqueue")[0]; indexingqueue_size=indexingqueue.firstChild.nextSibling; @@ -33,10 +37,13 @@ function handleStatus(){ document.getElementById("ppm").firstChild.nodeValue=ppm.firstChild.nodeValue; } function handleIndexingQueue(){ + if(indexingQueueRPC.readyState != 4){ + return; + } var indexingQueueResponse = indexingQueueRPC.responseXML; - indexingTable=document.getElementById("indexingTable"); + indexingTable=document.getElementById("indexingTable"); if(indexingQueueResponse != null){ - entries=indexingQueueResponse.getElementsByTagName("entry"); + entries=indexingQueueResponse.getElementsByTagName("entry"); } //skip the Tableheade @@ -83,7 +90,14 @@ function handleIndexingQueue(){ } field=field.nextSibling; } - row=createRow(initiator, depth, modified, anchor, url, size, hash); + /*field=getChild(entries[i], "initiator"); + if(field!=null){ + initiator=field.firstChild.nodeValue; + } + //... + */ + + row=createIndexingRow(initiator, depth, modified, anchor, url, size, hash); //create row if(inProcess){ row.setAttribute("class", "TableCellActive"); @@ -96,6 +110,16 @@ function handleIndexingQueue(){ dark=!dark; } } +function getChild(element, childname){ + child=element.firstChild; + while(child != null){ + if(child.nodeName==childname){ + return child; + } + child=child.nextSibling; + } + return null; +} function createCol(content){ @@ -104,7 +128,7 @@ function createCol(content){ col.appendChild(text); return col; } -function createRow(initiator, depth, modified, anchor, url, size, hash){ +function createIndexingRow(initiator, depth, modified, anchor, url, size, hash){ row=document.createElement("tr"); row.appendChild(createCol(initiator)); row.appendChild(createCol(depth));