better interaction

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7875 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 13 years ago
parent 3f0349e362
commit ca09081341

@ -19,6 +19,8 @@ var modifier = "";
var modifiertype = ""; var modifiertype = "";
function search(search, count, offset) { function search(search, count, offset) {
var navhtml = document.getElementById("searchnavigation");
if (navhtml != null) navhtml.innerHTML = "<div>loading...</div>";
query = search; query = search;
maximumRecords = count; maximumRecords = count;
if (count == "") maximumRecords = 1000; if (count == "") maximumRecords = 1000;
@ -51,6 +53,7 @@ function navget(list, name) {
} }
function preparepage(str) { function preparepage(str) {
document.getElementById("searchnavigation").innerHTML = "<div>parsing result...</div>";
var raw = document.getElementById("raw"); var raw = document.getElementById("raw");
if (raw != null) raw.innerHTML = str; if (raw != null) raw.innerHTML = str;
var rsp = eval("(" + str + ")"); var rsp = eval("(" + str + ")");
@ -69,11 +72,14 @@ function preparepage(str) {
if (modifiertype == "png" || modifiertype == "gif" || modifiertype == "jpg") { if (modifiertype == "png" || modifiertype == "gif" || modifiertype == "jpg") {
document.getElementById("searchresults").innerHTML = resultImages(); var tt = resultImages();
document.getElementById("searchresults").innerHTML = tt;
} else { } else {
document.getElementById("searchresults").innerHTML = resultList(); var tt = resultList();
document.getElementById("searchresults").innerHTML = tt;
} }
document.getElementById("searchnavigation").innerHTML = resultNavigation(); var tt = resultNavigation();
document.getElementById("searchnavigation").innerHTML = tt;
document.getElementById("serverlist").innerHTML = ""; document.getElementById("serverlist").innerHTML = "";
hideDownloadScript(); hideDownloadScript();
} }
@ -91,6 +97,7 @@ function hideDownloadScript() {
function resultNavigation() { function resultNavigation() {
var html = ""; var html = "";
if (searchresult.length > totalResults) totalResults = searchresult.length;
if (totalResults > 0) { if (totalResults > 0) {
html += "<div>" + searchresult.length + " results from a total of " + totalResults + " docs in index (not showing offline resources); search time: " + ((new Date()).getTime() - start.getTime()) + " milliseconds.&nbsp;"; html += "<div>" + searchresult.length + " results from a total of " + totalResults + " docs in index (not showing offline resources); search time: " + ((new Date()).getTime() - start.getTime()) + " milliseconds.&nbsp;";
html += "<div id=\"downloadbutton\" style=\"inline\"></div></div>"; html += "<div id=\"downloadbutton\" style=\"inline\"></div></div>";
@ -143,6 +150,7 @@ function resultNavigation() {
function resultList() { function resultList() {
var html = ""; var html = "";
if (searchresult.length > 0) { if (searchresult.length > 0) {
document.getElementById("searchnavigation").innerHTML = "<div>found " + searchresult.length + " documents, preparing table...</div>";
html += "<table class=\"sortable\" id=\"sortable\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"99%\">"; html += "<table class=\"sortable\" id=\"sortable\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"99%\">";
html += "<tr class=\"TableHeader\" valign=\"bottom\"><td width=\"10\">count</td><td width=\"40\">Protocol</td><td width=\"60\">Host</td><td width=\"260\">Path</td><td width=\"360\">Name</td><td width=\"60\">Size</td><td width=\"75\">Date</td></tr>"; html += "<tr class=\"TableHeader\" valign=\"bottom\"><td width=\"10\">count</td><td width=\"40\">Protocol</td><td width=\"60\">Host</td><td width=\"260\">Path</td><td width=\"360\">Name</td><td width=\"60\">Size</td><td width=\"75\">Date</td></tr>";
for (var i = 0; i < searchresult.length; i++) { html += resultLine("row", searchresult[i], i + 1); } for (var i = 0; i < searchresult.length; i++) { html += resultLine("row", searchresult[i], i + 1); }
@ -153,6 +161,7 @@ function resultList() {
function resultImages() { function resultImages() {
var html = ""; var html = "";
document.getElementById("searchnavigation").innerHTML = "<div>found " + searchresult.length + " images, preparing...</div>";
for (var i = 0; i < searchresult.length; i++) { html += resultLine("image", searchresult[i]); } for (var i = 0; i < searchresult.length; i++) { html += resultLine("image", searchresult[i]); }
return html; return html;
} }

@ -30,14 +30,6 @@
}; };
}); });
</script> </script>
<script type="text/javascript">
//<![CDATA[
var q = "#[query]#";
var s = "#[startRecord]#";
var m = "#[maximumRecords]#";
if (q != "") search(q, m, s);
//]]>
</script>
#(topmenu)# #(topmenu)#
#%env/templates/embeddedheader.template%# #%env/templates/embeddedheader.template%#
:: ::
@ -91,7 +83,11 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
document.getElementById("query").focus(); var q = "#[query]#";
var s = "#[startRecord]#";
var m = "#[maximumRecords]#";
if (q != "") search(q, m, s);
document.getElementById("search").focus();
//]]> //]]>
</script> </script>
#%env/templates/footer.template%# #%env/templates/footer.template%#

Loading…
Cancel
Save