Skip to content

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

(WIP) Add numbered page navigation when Javascript re-sorting is enabled.

JeremyRand4a9e64caea5b
diff --git a/htroot/js/yacysort.js b/htroot/js/yacysort.js
index ab4e96b1f..674d254b1 100644
--- a/htroot/js/yacysort.js
+++ b/htroot/js/yacysort.js
@@ -72,6 +72,33 @@ var laterPage = function() {
displayPage();
};
+// pageNumber starts at 0.
+var numberedPage = function(pageNumber) {
+ // Find all items.
+ var allItems = $("#resultscontainer .searchresults");
+
+ var itemNumber = pageNumber * requestedResults;
+
+ // Check if the item number is too high.
+ while ( allItems.length - 1 < itemNumber) {
+ itemNumber = itemNumber - requestedResults;
+ }
+
+ // If the beginning of results is requested, set highestRanking to Infinity.
+ if ( itemNumber <= 0 ) {
+ highestRanking = Infinity;
+ }
+ else {
+ var item = allItems.get(itemNumber);
+ highestRanking = parseFloat($(item).data("ranking"));
+ }
+
+ console.log("highestRanking is now " + highestRanking);
+
+ // Update the display to show the new page.
+ displayPage();
+};
+
var processSidebarNavProtocols = function(navProtocolsOld, navProtocolsNew) {
navProtocolsOld.find(".btn-group-xs").each( function(index, oldProtocol) {
var protocolId = $(oldProtocol).attr("id");