|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<title>YaCy Interactive Search</title>
|
|
|
|
#%env/templates/metas.template%#
|
|
|
|
<script language="Javascript">
|
|
|
|
function xmlhttpPost() {
|
|
|
|
var xmlHttpReq = false;
|
|
|
|
var self = this;
|
|
|
|
if (window.XMLHttpRequest) { // Mozilla/Safari
|
|
|
|
self.xmlHttpReq = new XMLHttpRequest();
|
|
|
|
}
|
|
|
|
else if (window.ActiveXObject) { // IE
|
|
|
|
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
|
|
|
|
}
|
|
|
|
var searchform = document.forms['searchform'];
|
|
|
|
self.xmlHttpReq.open('GET', "yacysearch.json?verify=false&resource=local&maximumRecords=100&query=" + searchform.query.value, true);
|
|
|
|
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
self.xmlHttpReq.onreadystatechange = function() {
|
|
|
|
if (self.xmlHttpReq.readyState == 4) {
|
|
|
|
updatepage(self.xmlHttpReq.responseText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self.xmlHttpReq.send(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
function updatepage(str){
|
|
|
|
var raw = document.getElementById("raw");
|
|
|
|
if (raw != null) raw.innerHTML = str;
|
|
|
|
var rsp = eval("("+str+")");
|
|
|
|
var firstChannel = rsp.channels[0];
|
|
|
|
var totalResults = firstChannel.totalResults;
|
|
|
|
var startIndex = firstChannel.startIndex;
|
|
|
|
var itemsPerPage = firstChannel.itemsPerPage;
|
|
|
|
var html = "<br>total results = " + totalResults;
|
|
|
|
var item;
|
|
|
|
html += "<table class=\"networkTable\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">";
|
|
|
|
html += "<tr class=\"TableHeader\" valign=\"bottom\"><td>Name</td><td>Description</td><td>Link</td></tr>";
|
|
|
|
for (var i = 0; i < firstChannel.items.length; i++) {
|
|
|
|
item = firstChannel.items[i];
|
|
|
|
html += "<tr class=\"TableCellLight\"><td>"+ item.title + "</td>";
|
|
|
|
html += "<td>" + item.description + "</td>";
|
|
|
|
html += "<td><a href=\"" + item.link + "\">" + item.link + "</a></td></tr>";
|
|
|
|
}
|
|
|
|
html += "</table>";
|
|
|
|
document.getElementById("result").innerHTML = html;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
#%env/templates/header.template%#
|
|
|
|
|
|
|
|
<form name="searchform" onkeyup='xmlhttpPost(); return false;'>
|
|
|
|
<p>Query: <input name="query" type="text">
|
|
|
|
<!--<input value="Search" type="submit">--></p>
|
|
|
|
|
|
|
|
<div id="result"></div>
|
|
|
|
<!--<pre>Raw JSON String: <div id="raw"></div></pre>-->
|
|
|
|
</form>
|
|
|
|
#%env/templates/footer.template%#
|
|
|
|
</body>
|
|
|
|
</html>
|