2008-03-30 21:51:19 +02:00
var AJAX _OFF = "/env/grafics/empty.gif" ;
var AJAX _ON = "/env/grafics/ajax.gif" ;
var timeout = "" ;
2006-02-18 13:01:52 +01:00
function handleResponse ( ) {
2010-09-30 14:50:34 +02:00
if ( http . readyState == 4 ) {
2006-02-18 13:01:52 +01:00
var response = http . responseXML ;
2007-05-06 11:52:04 +02:00
2010-09-30 14:50:34 +02:00
// get the document title
2009-06-22 13:24:01 +02:00
doctitle = "" ;
2010-09-30 14:50:34 +02:00
if ( response . getElementsByTagName ( "title" ) [ 0 ] . firstChild != null ) {
2009-06-22 13:24:01 +02:00
doctitle = response . getElementsByTagName ( "title" ) [ 0 ] . firstChild . nodeValue ;
2006-02-18 13:01:52 +01:00
}
2010-10-06 02:00:23 +02:00
//document.getElementById("title").innerHTML=doctitle;
document . getElementById ( "bookmarkTitle" ) . value = doctitle ;
2007-05-06 11:52:04 +02:00
2009-07-24 13:54:04 +02:00
// determine if crawling is allowed by the robots.txt
2009-06-22 13:24:01 +02:00
docrobotsOK = "" ;
2006-02-18 13:01:52 +01:00
if ( response . getElementsByTagName ( "robots" ) [ 0 ] . firstChild != null ) {
2009-06-22 13:24:01 +02:00
docrobotsOK = response . getElementsByTagName ( "robots" ) [ 0 ] . firstChild . nodeValue ;
2006-02-18 13:01:52 +01:00
}
robotsOKspan = document . getElementById ( "robotsOK" ) ;
if ( robotsOKspan . firstChild ) {
robotsOKspan . removeChild ( robotsOKspan . firstChild ) ;
}
2010-09-30 14:50:34 +02:00
if ( docrobotsOK == 1 ) {
2006-02-18 13:01:52 +01:00
img = document . createElement ( "img" ) ;
img . setAttribute ( "src" , "/env/grafics/ok.png" ) ;
2007-05-07 16:05:49 +02:00
img . setAttribute ( "width" , "32px" ) ;
img . setAttribute ( "height" , "32px" ) ;
2010-10-06 02:00:23 +02:00
img . setAttribute ( "alt" , "robots.txt - OK" ) ;
2006-02-18 13:01:52 +01:00
robotsOKspan . appendChild ( img ) ;
2010-09-30 14:50:34 +02:00
} else if ( docrobotsOK == 0 ) {
2006-02-18 13:01:52 +01:00
img = document . createElement ( "img" ) ;
2007-05-07 16:05:49 +02:00
img . setAttribute ( "src" , "/env/grafics/bad.png" ) ;
img . setAttribute ( "width" , "32px" ) ;
img . setAttribute ( "height" , "32px" ) ;
2010-10-06 02:00:23 +02:00
img . setAttribute ( "alt" , "robots.txt - Bad" ) ;
2006-02-18 13:01:52 +01:00
robotsOKspan . appendChild ( img ) ;
2010-10-06 02:00:23 +02:00
// robotsOKspan.appendChild(img);
2010-09-30 14:50:34 +02:00
} else {
2006-02-18 13:01:52 +01:00
robotsOKspan . appendChild ( document . createTextNode ( "" ) ) ;
document . getElementById ( "robotsOK" ) . innerHTML = "" ;
2007-05-06 11:52:04 +02:00
}
2010-09-30 14:50:34 +02:00
// get the sitemap URL contained in the robots.txt
2007-06-07 09:40:32 +02:00
if ( document . getElementsByName ( "sitemapURL" ) . length > 0 ) {
2014-06-15 22:50:04 +02:00
sitemap = "" ;
// there can be zero, one or many sitemaps
sitemapElement = response . getElementsByTagName ( "sitemap" ) ;
if ( sitemapElement != null && sitemapElement . length > 0 && sitemapElement [ 0 ] . firstChild != null ) {
// if there are several, we take only the first
sitemap = sitemapElement [ 0 ] . firstChild . nodeValue ;
}
document . getElementsByName ( "sitemapURL" ) [ 0 ] . value = sitemap ;
if ( sitemap ) document . getElementById ( "sitemap" ) . disabled = false ;
2007-06-07 09:40:32 +02:00
}
2010-09-30 14:50:34 +02:00
sitelist = "" ;
if ( response . getElementsByTagName ( "sitelist" ) [ 0 ] . firstChild != null ) {
sitelist = response . getElementsByTagName ( "sitelist" ) [ 0 ] . firstChild . nodeValue ;
}
document . getElementById ( "sitelistURLs" ) . innerHTML = sitelist ;
2010-10-01 01:57:58 +02:00
if ( sitelist ) document . getElementById ( "sitelist" ) . disabled = false ;
2007-05-06 11:52:04 +02:00
// clear the ajax image
2010-10-06 02:00:23 +02:00
document . getElementById ( "ajax" ) . setAttribute ( "src" , AJAX _OFF ) ;
2006-02-18 13:01:52 +01:00
}
}
2010-09-30 14:50:34 +02:00
function changed ( ) {
2006-02-18 13:01:52 +01:00
window . clearTimeout ( timeout ) ;
timeout = window . setTimeout ( "loadInfos()" , 1500 ) ;
}
2010-09-30 14:50:34 +02:00
function loadInfos ( ) {
2007-05-06 11:52:04 +02:00
// displaying ajax image
2010-10-06 02:00:23 +02:00
document . getElementById ( "ajax" ) . setAttribute ( "src" , AJAX _ON ) ;
2007-05-06 11:52:04 +02:00
2010-10-06 02:00:23 +02:00
url = document . getElementById ( "crawlingURL" ) . value ;
2010-12-09 18:17:25 +01:00
if ( url . indexOf ( "ftp" ) == 0 || url . indexOf ( "smb" ) == 0 ) document . getElementById ( "crawlingQ" ) . disabled = true ; else document . getElementById ( "crawlingQ" ) . disabled = false ;
2011-11-15 01:22:40 +01:00
sndReq ( '/api/getpageinfo_p.xml?actions=title,robots&url=' + url ) ;
document . getElementById ( "api" ) . innerHTML = "<a href='http://localhost:8090/api/getpageinfo_p.xml?actions=title,robots&url=" + url + "' id='apilink'><img src='/env/grafics/api.png' width='60' height='40' alt='API'/></a><span>See the page info about the start url.</span>" ;
2006-02-18 13:01:52 +01:00
}