Skip to content
Permalink
Browse files

+ Page lists (1 2 ... 7 8) will now expand on both side of the suspen…

…sion point, rather than just its left. This is MUCH more practical when navigating through hundreds of pages. Also reduced the number of entries to 20 per side (40 overall) instead of 50 overall, because 40 is already more than enough. (script.js)

+ Added strict mode to the main script file. I've been using that for years on Lestrades.com for years, and standards-oriented people like it anyway. It's just a few bytes. (script.js)
  • Loading branch information...
Nao committed May 11, 2019
1 parent b3396c7 commit 9de5de86f62d9d6f40a42f77ba44486c24c5d711
Showing with 9 additions and 3 deletions.
  1. +9 −3 core/javascript/script.js
@@ -9,6 +9,8 @@

@language index;

'use strict';

var
oThought,
weEditors = [],
@@ -272,10 +274,10 @@ function breakLinks(where)
// Shows the page numbers by clicking the dots.
function expandPages(spanNode, firstPage, lastPage, perPage)
{
var i = firstPage, pageLimit = 50, baseURL = $(spanNode).data('href');
var i = firstPage, pageLimit = 20, baseURL = $(spanNode).data('href');

// Prevent too many pages from being loaded at once.
if ((lastPage - firstPage) / perPage > pageLimit)
if ((lastPage - firstPage) / perPage > pageLimit * 2)
{
var oldLastPage = lastPage;
lastPage = firstPage + perPage * pageLimit;
@@ -286,7 +288,11 @@ function expandPages(spanNode, firstPage, lastPage, perPage)
$(spanNode).before('<a href="' + baseURL.replace(/%1\$d/, i).replace(/%%/g, '%') + '">' + (1 + i / perPage) + '</a> ');

if (oldLastPage)
$(spanNode).off().click(function () { expandPages(this, lastPage, oldLastPage, perPage); });
{
for (i = oldLastPage - perPage; i > oldLastPage - perPage * pageLimit; i -= perPage)
$(spanNode).after(' <a href="' + baseURL.replace(/%1\$d/, i).replace(/%%/g, '%') + '">' + (1 + i / perPage) + '</a>');
$(spanNode).off().click(function () { expandPages(this, lastPage, oldLastPage - perPage * pageLimit, perPage); });
}
else
$(spanNode).remove();
}

0 comments on commit 9de5de8

Please sign in to comment.
You can’t perform that action at this time.