DELETE_STRING="delete"; BAR_IMG1="/env/grafics/green-block.png"; BAR_IMG2="/env/grafics/red-block.png"; WORDCACHEBAR_LENGTH=1/4; var statusRPC; var queuesRPC; var refreshInterval=5; var wait=0; var changing=false; //change the interval var statusLoaded=true; var queueLoaded=true; function initCrawler(){ refresh(); //loadInterval=window.setInterval("refresh()", refreshInterval*1000); countInterval=window.setInterval("countdown()", 1000); } function changeInterval(){ if(!changing){ window.clearInterval(countInterval); counter=document.getElementById("nextUpdate"); //counter.innerHTML=''; //document.getElementById("newInterval").focus(); counter.value=refreshInterval; changing=true; } } function newInterval(){ refreshInterval=document.getElementById("nextUpdate").value; refresh(); countInterval=window.setInterval("countdown()", 1000); changing=false; } function countdown(){ if(statusLoaded && queueLoaded){ document.getElementById("nextUpdate").value=wait; wait--; if(wait==0){ refresh(); } } } function refresh(){ wait=refreshInterval; statusLoaded=false; queueLoaded=false; requestStatus(); requestQueues(); } function requestStatus(){ statusRPC=createRequestObject(); statusRPC.open('get', '/api/status_p.xml?html='); statusRPC.onreadystatechange = handleStatus; statusRPC.send(null); } function requestQueues(){ queuesRPC=createRequestObject(); queuesRPC.open('get', '/api/queues_p.xml?html='); queuesRPC.onreadystatechange = handleQueues; queuesRPC.send(null); } function handleStatus(){ if(statusRPC.readyState != 4){ return; } var statusResponse = statusRPC.responseXML; statusTag=getFirstChild(statusResponse, "status"); ppm=getValue(getFirstChild(statusTag, "ppm")); var ppmNum = document.getElementById("ppmNum"); removeAllChildren(ppmNum); ppmNum.appendChild(document.createTextNode(ppm)); var ppmSpan = document.getElementById("ppmSpan"); removeAllChildren(ppmSpan); for(i = 0; i < ppm / 10; i++){ img=document.createElement("img"); img.setAttribute("src", BAR_IMG1); ppmSpan.appendChild(img); } // traffic output (no bar up to now) traffic = getFirstChild(statusTag, "traffic"); trafficCrawlerValue = getValue(getFirstChild(traffic, "crawler")); trafCrawlerSpan = document.getElementById("trafficCrawler"); removeAllChildren(trafCrawlerSpan); trafCrawlerSpan.appendChild(document.createTextNode(Math.round((trafficCrawlerValue) / 1024 / 10.24) / 100)); var wordCacheSize=getValue(getFirstChild(statusTag, "wordCacheSize")); var wordCacheMaxSize=getValue(getFirstChild(statusTag, "wordCacheMaxSize")); wordCacheNum=document.getElementById("wordcacheNum"); removeAllChildren(wordCacheNum); wordCacheNum.appendChild(document.createTextNode(wordCacheSize+"/"+wordCacheMaxSize)); wordCacheSpan=document.getElementById("wordcacheSpan"); removeAllChildren(wordCacheSpan); var img; var percent=Math.round(wordCacheSize/wordCacheMaxSize*100); for(i=0;i 80) { return url.substr(0, 80) + "..."; } else { return url; } } function createIndexingRow(queue, profile, initiator, depth, modified, anchor, url, size, deletebutton){ row=document.createElement("tr"); row.setAttribute("height", 10); row.appendChild(createCol(queue)); row.appendChild(createCol(profile)); row.appendChild(createCol(initiator)); row.appendChild(createCol(depth)); row.appendChild(createCol(modified)); row.appendChild(createCol(anchor)); row.appendChild(createLinkCol(url, shortenURL(url))); row.appendChild(createCol(size)); row.appendChild(deletebutton); return row; }