Fix pagination incompatibility

Javascript function paginateButton does not work with "p" GET parameter in first position, regex only takes &p and not ?p.
This commit is contained in:
Mainmich committed 2013-09-25 18:33:58 +02:00
1 parent 5245038ea1
commit a6e67b078e
1 file changed
+2 -2
+2 -2
View File
@@ -230,11 +230,11 @@ function initLayered()
function paginationButton() { function paginationButton() {
$('#pagination a').not(':hidden').each(function () { $('#pagination a').not(':hidden').each(function () {
if ($(this).attr('href').search('&p=') == -1) { if ($(this).attr('href').search(/&|\?p=/) == -1) {
var page = 1; var page = 1;
} }
else { else {
var page = $(this).attr('href').replace(/^.*&p=(\d+).*$/, '$1'); var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1');
} }
var location = window.location.href.replace(/#.*$/, ''); var location = window.location.href.replace(/#.*$/, '');
$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page); $(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);