Permalink
Browse files

(WIP) Add numbered page navigation when Javascript re-sorting is enab…

…led.

TODO: Add UI for selecting the number.
  • Loading branch information...
JeremyRand committed Apr 3, 2017
1 parent 6ec256d commit 4a9e64caea5b0111b807c539918b465e0f2051ec
Showing with 27 additions and 0 deletions.
  1. +27 −0 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");

0 comments on commit 4a9e64c

Please sign in to comment.