From 9524b9c16ab2236c33adb07229ee7545d8ade4d7 Mon Sep 17 00:00:00 2001
From: fuchsi
Date: Mon, 17 Sep 2007 19:39:15 +0000
Subject: [PATCH] second try of rev 4100 :). Tested in Iceweasel/Firefox 2.0.6,
Konqueror 3.5.7, Opera 9.23 (all linux) and IE6-SP1 (wine)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4102 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/env/base.css | 28 ++++++++++++++++++++++++++++
htroot/js/yacysearch.js | 36 +++++++++++++++++++-----------------
htroot/yacysearch.html | 5 +++--
htroot/yacysearch.java | 28 ++++++++++++++--------------
4 files changed, 64 insertions(+), 33 deletions(-)
diff --git a/htroot/env/base.css b/htroot/env/base.css
index e7a548f0e..0f3db2acb 100644
--- a/htroot/env/base.css
+++ b/htroot/env/base.css
@@ -241,9 +241,37 @@ div.ProgressBar {
}
div.ProgressBarFill {
margin:0px;
+ padding:0px;
height:100%; /*not valid value for Netscape 8*/
}
+#resCounter {
+ /* left part of the progress bar */
+ position: absolute;
+ left: 1em;
+}
+
+#resProgBar {
+ height: 1.5em;
+ margin: 1em auto;
+ position: relative; /* for "relative" absolute pos of children */
+ text-align: left;
+ width: 100%;
+ float: none;
+}
+
+#resNav {
+ /* right part of the progress bar */
+ position: absolute;
+ right: 1em;
+}
+
+#resProgFill {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+}
+
div.bookmarkList, div.Tags {
margin-top:1em;
}
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js
index e30c7ce5f..2ec23214c 100644
--- a/htroot/js/yacysearch.js
+++ b/htroot/js/yacysearch.js
@@ -1,7 +1,4 @@
function Progressbar(length, parent) {
- // the description (displayed above the progressbar while loading the results), should be translated
- var DESCRIPTION_STRING = "Loading results...";
-
// the number of steps of the bar
this.length = length;
// the current position, expressed in steps (so 100% = length)
@@ -12,41 +9,46 @@ function Progressbar(length, parent) {
// use this function to display the progress, because it updates everything
this.step = function(count) {
- this.position += count;
+ if (this.position < this.length)
+ this.position += count;
+
// update the bar
this.percentage = this.position*(100/this.length);
this.fill.style.width = this.percentage + "%";
// if the end is reached, the bar is hidden/removed
- if(this.position==this.length)
- removeAllChildren(this.element);
+ if(this.position >= this.length) {
+ this.fill.style.visibility = "hidden";
+ }
}
// the actual progressbar
var bar = document.createElement("div");
- bar.className = "ProgressBar";
- bar.style.width = "100%";
- bar.style.height = "20px";
- bar.style.margin = "10px auto";
- bar.style.textAlign = "left";
+ bar.id = "resProgBar";
+ bar.className ="ProgressBar";
// the actual bar
this.fill = document.createElement("div");
+ this.fill.id = "resProgFill";
this.fill.className = "ProgressBarFill";
this.fill.style.width = "0%"
bar.appendChild(this.fill);
- // a description for the bar
- var description = document.createTextNode(DESCRIPTION_STRING);
- var textcontainer = document.createElement("strong");
- textcontainer.appendChild(description);
-
// the container for the elements used by the Progressbar
this.element = document.createElement("div");
this.element.style.textAlign = "center";
// get hasLayout in IE, needed because of the percentage as width of the bar
this.element.className = "gainlayout";
- this.element.appendChild(textcontainer);
+
+ // results counter inside progress bar
+ var resCounter = document.getElementById("resCounter");
+ resCounter.style.display = "inline";
+ bar.appendChild(resCounter);
+
+ // the result sites navigation
+ var resNav = document.getElementById("resNav");
+ resNav.style.display = "inline";
+ bar.appendChild(resNav);
this.element.appendChild(bar);
parent.appendChild(this.element);
}
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 40dd0ca2b..dfac3477d 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -99,8 +99,9 @@ document.getElementById("Enter").value = "search again - catch up more links";
::
No Results. (length of search words must be at least 3 characters)
::
- #[offset]#-#[linkcount]# results from a total number of #[totalcount]# known#(globalresults)#.::, #[globalcount]# links from other YaCy peers.#(/globalresults)#
- Search Result Pages: #[pagenav]#
+
+ #[offset]#-#[linkcount]# results from a total number of #[totalcount]# known#(globalresults)#.::, #[globalcount]# links from other YaCy peers.#(/globalresults)#
+ #[resnav]#
::
Searching the web with this peer is disabled for unauthorized users. Please log in as administrator to use the search function
#(/num-results)#
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 108562b9a..4b132ca48 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -323,29 +323,29 @@ public class yacysearch {
prop.put("num-results_linkcount", 0);
// compose page navigation
- StringBuffer pagenav = new StringBuffer();
+ StringBuffer resnav = new StringBuffer();
int thispage = offset / theQuery.displayResults();
- if (thispage == 0) pagenav.append("< "); else {
- pagenav.append(navurla(thispage - 1, display, theQuery));
- pagenav.append("< ");
+ if (thispage == 0) resnav.append("< "); else {
+ resnav.append(navurla(thispage - 1, display, theQuery));
+ resnav.append("< ");
}
int numberofpages = Math.min(10, Math.min(thispage + 2, (theSearch.getGlobalCount() + theSearch.getLocalCount()) / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) {
if (i == thispage) {
- pagenav.append("");
- pagenav.append(i + 1);
- pagenav.append(" ");
+ resnav.append("");
+ resnav.append(i + 1);
+ resnav.append(" ");
} else {
- pagenav.append(navurla(i, display, theQuery));
- pagenav.append(i + 1);
- pagenav.append(" ");
+ resnav.append(navurla(i, display, theQuery));
+ resnav.append(i + 1);
+ resnav.append(" ");
}
}
- if (thispage >= numberofpages) pagenav.append(">"); else {
- pagenav.append(navurla(thispage + 1, display, theQuery));
- pagenav.append(">");
+ if (thispage >= numberofpages) resnav.append(">"); else {
+ resnav.append(navurla(thispage + 1, display, theQuery));
+ resnav.append(">");
}
- prop.putASIS("num-results_pagenav", pagenav.toString());
+ prop.putASIS("num-results_resnav", resnav.toString());
// generate the search result lines; they will be produced by another servlet
for (int i = 0; i < theQuery.displayResults(); i++) {