No pagination when number of element is insufficient
fixes #17 Also fixes URL issue in explorer
This commit is contained in:
		@@ -528,11 +528,11 @@ jQuery(document).ready(function($)
 | 
				
			|||||||
                pageSize: pageSize,
 | 
					                pageSize: pageSize,
 | 
				
			||||||
                pageRange: getPageRange(),
 | 
					                pageRange: getPageRange(),
 | 
				
			||||||
                className: 'paginationjs-theme-ginou',
 | 
					                className: 'paginationjs-theme-ginou',
 | 
				
			||||||
 | 
					                hideWhenLessThanOnePage: true,
 | 
				
			||||||
                callback: function (response, pagination)
 | 
					                callback: function (response, pagination)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    currentPage = pagination.pageNumber;
 | 
					                    currentPage = pagination.pageNumber;
 | 
				
			||||||
                    urlParams = new URLSearchParams(window.location.search)
 | 
					                    urlParams = new URLSearchParams(window.location.search)
 | 
				
			||||||
                    console.log(urlParams.get('page'));
 | 
					 | 
				
			||||||
                    if (urlParams.get('page') == undefined)
 | 
					                    if (urlParams.get('page') == undefined)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        window.history.replaceState('', '', window.location.pathname + window.location.search + '&page=' + currentPage + window.location.hash);
 | 
					                        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...
 | 
					                // 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)
 | 
					                // (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);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,6 +56,7 @@ jQuery(document).ready(function($)
 | 
				
			|||||||
            pageSize: pageSize,
 | 
					            pageSize: pageSize,
 | 
				
			||||||
            pageRange: getPageRange(),
 | 
					            pageRange: getPageRange(),
 | 
				
			||||||
            className: 'paginationjs-theme-ginou',
 | 
					            className: 'paginationjs-theme-ginou',
 | 
				
			||||||
 | 
					            hideWhenLessThanOnePage: true,
 | 
				
			||||||
            callback: function (response, pagination)
 | 
					            callback: function (response, pagination)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                currentPage = pagination.pageNumber;
 | 
					                currentPage = pagination.pageNumber;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user