Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for page navigation bar

Michael Peter Christenf0f22e68bbfa
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js
index 294197a03..e81416e22 100644
--- a/htroot/js/yacysearch.js
+++ b/htroot/js/yacysearch.js
@@ -31,12 +31,15 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localResourceS
if (document.getElementById("remotePeerCount") != null) document.getElementById("remotePeerCount").firstChild.nodeValue = remotePeerCount;
// compose page navigation
- var percent = 100 * (itemscount - offset + 1) / itemsperpage;
- if (percent == 100) {
- window.setTimeout(fadeOutBar, 500);
- document.getElementById("progressbar").setAttribute('class',"progress-bar progress-bar-success");
+ if (document.getElementById("progressbar").getAttribute('class') != "progress-bar progress-bar-success") {
+ var percent = 100 * (itemscount - offset + 1) / itemsperpage;
+ if (percent == 100) {
+ document.getElementById("progressbar").setAttribute('style',"transition:transform 0s;");
+ document.getElementById("progressbar").setAttribute('class',"progress-bar progress-bar-success");
+ window.setTimeout(fadeOutBar, 500);
+ }
+ document.getElementById("progressbar").setAttribute('style',"width:" + percent + "%");
}
- document.getElementById("progressbar").setAttribute('style',"width:" + percent + "%");
var resnav = "<ul class=\"pagination\">";
thispage = Math.floor(offset / itemsperpage);
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 7058006c1..c10fcb6b2 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -208,13 +208,11 @@ document.getElementById("Enter").innerHTML = "search again";
#(resultTable)#::</table>#(/resultTable)#
<!-- linklist end -->
-<!-- attach the bottomline (customer option) -->
-<!--#(pageNavBottom)#::<div id="pageNavBottom" style="text-align:center">#[resnav]#</div>#(/pageNavBottom)#-->
#(num-results)#
::
::
::
- <span id="resNav" style="display: inline;">#[resnav]#</span>
+ <span id="resNav" style="display: inline;"></span>
</div>
::
#(/num-results)#
@@ -254,6 +252,8 @@ function latestinfo() {
};
self.xmlHttpReq.send(null);
}
+window.setTimeout('latestinfo();',500); // we need that to get a correct pagination bar at the end of the page
+window.setTimeout('latestinfo();',1000);
// TODO: resets statistic on navigating to next page in Jetty implementation
/*
window.setTimeout('latestinfo();',500);
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 171d732de..9444e1558 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -830,44 +830,6 @@ public class yacysearch {
prop.put("num-results_globalresults_remoteIndexCount", Formatter.number(theSearch.remote_rwi_available.get() + theSearch.remote_solr_available.get(), true));
prop.put("num-results_globalresults_remotePeerCount", Formatter.number(theSearch.remote_rwi_peerCount.get() + theSearch.remote_solr_peerCount.get(), true));
- // compose page navigation
- final StringBuilder resnav = new StringBuilder(200);
- resnav.append("<ul class=\"pagination\">");
- final int thispage = startRecord / theQuery.itemsPerPage();
- if (thispage == 0) {
- resnav.append("<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>");
- } else {
- resnav.append("<li><a id=\"prevpage\" href=\"");
- resnav.append(QueryParams.navurl("html", thispage - 1, theQuery, null).toString());
- resnav.append("\">&laquo;</a></li>");
- }
-
- final int numberofpages = Math.min(10, 1 + ((theSearch.getResultCount() - 1) / theQuery.itemsPerPage()));
- for (int i = 0; i < numberofpages; i++) {
- if (i == thispage) {
- resnav.append("<li class=\"active\"><a href=\"#\">");
- resnav.append(i + 1);
- resnav.append("</a></li>");
- } else {
- resnav.append("<li><a href=\"");
- resnav.append(QueryParams.navurl("html", i, theQuery, null).toString());
- resnav.append("\">" + (i + 1) + "</a></li>");
- }
- }
- if (thispage >= numberofpages) {
- resnav.append("<li><a href=\"#\">&raquo;</a></li>");
- } else {
- resnav.append("<li><a id=\"nextpage\" href=\"");
- resnav.append(QueryParams.navurl("html", thispage + 1, theQuery, null).toString());
- resnav.append("\">&raquo;</a>");
- }
- resnav.append("</ul>");
- final String resnavs = resnav.toString();
-
- prop.put("num-results_resnav", resnavs);
- prop.put("pageNavBottom", (theSearch.getResultCount() - startRecord > 6) ? 1 : 0); // if there are more results than may fit on the page we add a navigation at the bottom
- prop.put("pageNavBottom_resnav", resnavs);
-
// generate the search result lines; the content will be produced by another servlet
for ( int i = 0; i < theQuery.itemsPerPage(); i++ ) {
prop.put("results_" + i + "_item", startRecord + i);