summaryrefslogtreecommitdiff
path: root/htroot/js/yacysearch.js
diff options
context:
space:
mode:
Diffstat (limited to 'htroot/js/yacysearch.js')
-rw-r--r--htroot/js/yacysearch.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/htroot/js/yacysearch.js b/htroot/js/yacysearch.js
index 09305031d..dc9a19868 100644
--- a/htroot/js/yacysearch.js
+++ b/htroot/js/yacysearch.js
@@ -62,7 +62,8 @@ function renderPaginationButtons(buttonsList, offset, itemsperpage, totalcount,
var firstPage = thispage - (thispage % 10);
var prevPageElement = buttons[0];
- var prevPageLink = prevPageElement.firstChild;
+ var links = prevPageElement.getElementsByTagName("a");
+ var prevPageLink = links.length == 1 ? links[0] : null;
if (thispage == 0) {
/* First page : the prev page button is disabled */
prevPageElement.className = "disabled";
@@ -83,14 +84,12 @@ function renderPaginationButtons(buttonsList, offset, itemsperpage, totalcount,
}
}
- var nextPageElement = buttons[buttons.length - 1];
-
var totalPagesNb = Math.floor(1 + ((totalcount - 1) / itemsperpage));
var numberofpages = Math.min(10, totalPagesNb - firstPage);
if (!numberofpages) {
numberofpages = 10;
}
- if(numberofpages > 1) {
+ if(totalPagesNb > 1 && numberofpages >= 1) {
buttonsList.className = "pagination";
} else {
/* Hide the pagination buttons when there is less than one page of results */
@@ -140,7 +139,9 @@ function renderPaginationButtons(buttonsList, offset, itemsperpage, totalcount,
buttonsList.removeChild(buttons[buttons.length - 2]);
}
- var nextPageLink = nextPageElement.firstChild;
+ var nextPageElement = buttons[buttons.length - 1];
+ links = nextPageElement.getElementsByTagName("a");
+ var nextPageLink = links.length == 1 ? links[0] : null;
if ((localQuery && thispage >= (totalPagesNb - 1))
|| (!localQuery && thispage >= (numberofpages - 1))) {
/* Last page on a local query, or last fetchable page in p2p mode : the next page button is disabled */
@@ -181,7 +182,7 @@ function parseFormattedInt(strIntValue) {
return intValue;
}
-function statistics(offset, itemscount, itemsperpage, totalcount, localIndexCount, remoteIndexCount, remotePeerCount, navurlbase, localQuery, feedRunning, jsResort) {
+function statistics(offset, itemscount, itemsperpage, totalcount, localIndexCount, remoteIndexCount, remotePeerCount, navurlbase, localQuery, feedRunning, jsResort, updatePagination) {
var totalcountIntValue = parseFormattedInt(totalcount);
var offsetIntValue = parseFormattedInt(offset);
var itemscountIntValue = parseFormattedInt(itemscount);
@@ -259,7 +260,7 @@ function statistics(offset, itemscount, itemsperpage, totalcount, localIndexCoun
progresseBarElement.setAttribute('style',"width:" + percent + "%");
}
var buttonsList = document.getElementById("paginationButtons");
- if (buttonsList != null && !jsResort) {
+ if (buttonsList != null && !jsResort && updatePagination) {
renderPaginationButtons(buttonsList, offsetIntValue, itemsperpageIntValue, totalcountIntValue, navurlbase, localQuery, jsResort);
}
}