You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
19 years ago
|
function AllSnippets() {
|
||
|
var query = document.getElementsByName("former")[0].value;
|
||
|
|
||
|
var span = document.getElementsByTagName("span");
|
||
|
for(var x=0;x<span.length;x++) {
|
||
|
if (span[x].className == 'snippetLoading') {
|
||
|
var url = document.getElementById("url" + span[x].id);
|
||
|
requestSnippet(url,query);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
function requestSnippet(url, query){
|
||
19 years ago
|
var request=createRequestObject();
|
||
|
request.open('get', '/xml/snippet.xml?url=' + escape(url) + '&search=' + escape(query),true);
|
||
|
request.onreadystatechange = function () {handleState(request)};
|
||
|
request.send(null);
|
||
19 years ago
|
}
|
||
|
|
||
|
function handleState(req) {
|
||
|
if(req.readyState != 4){
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
var response = req.responseXML;
|
||
|
|
||
|
var snippetText = response.getElementsByTagName("text")[0].firstChild.data;
|
||
|
var urlHash = response.getElementsByTagName("urlHash")[0].firstChild.data;
|
||
|
var status = response.getElementsByTagName("status")[0].firstChild.data;
|
||
|
|
||
19 years ago
|
var span = document.getElementById(urlHash)
|
||
19 years ago
|
removeAllChildren(span);
|
||
19 years ago
|
//span.removeChild(span.firstChild);
|
||
19 years ago
|
|
||
|
if (status < 11) {
|
||
|
span.className = "snippetLoaded";
|
||
19 years ago
|
//span.setAttribute("class", "snippetLoaded");
|
||
19 years ago
|
} else {
|
||
|
span.className = "snippetError";
|
||
|
//span.setAttribute("class", "snippetError");
|
||
|
}
|
||
|
|
||
|
var snippetNode = document.createTextNode(snippetText);
|
||
|
span.appendChild(snippetNode);
|
||
|
}
|