No pagination when number of element is insufficient

fixes #17
Also fixes URL issue in explorer
This commit is contained in:
Théo Marchal 2021-02-16 02:24:44 +01:00
parent e8d7e401b0
commit bcb0eec9f6
2 changed files with 5 additions and 2 deletions

View File

@ -528,11 +528,11 @@ jQuery(document).ready(function($)
pageSize: pageSize,
pageRange: getPageRange(),
className: 'paginationjs-theme-ginou',
hideWhenLessThanOnePage: true,
callback: function (response, pagination)
{
currentPage = pagination.pageNumber;
urlParams = new URLSearchParams(window.location.search)
console.log(urlParams.get('page'));
if (urlParams.get('page') == undefined)
{
window.history.replaceState('', '', window.location.pathname + window.location.search + '&page=' + currentPage + window.location.hash);
@ -659,7 +659,9 @@ jQuery(document).ready(function($)
{
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
// (apparently fancybox changes back to the original url it had when starting)
//window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
urlParams = new URLSearchParams(window.location.search)
trimSearch = window.location.search.substr(0, window.location.search.lastIndexOf('&'));
window.history.replaceState('', '', window.location.pathname + trimSearch + '&page=' + currentPage + window.location.hash);
}
});
});

View File

@ -56,6 +56,7 @@ jQuery(document).ready(function($)
pageSize: pageSize,
pageRange: getPageRange(),
className: 'paginationjs-theme-ginou',
hideWhenLessThanOnePage: true,
callback: function (response, pagination)
{
currentPage = pagination.pageNumber;