From a6e67b078e067445eef358e907649e843a1dc26a Mon Sep 17 00:00:00 2001 From: Mainmich Date: Wed, 25 Sep 2013 18:33:58 +0200 Subject: [PATCH] Fix pagination incompatibility Javascript function paginateButton does not work with "p" GET parameter in first position, regex only takes &p and not ?p. --- modules/blocklayered/blocklayered.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js index 5eaffb4a2..0edae4fd8 100644 --- a/modules/blocklayered/blocklayered.js +++ b/modules/blocklayered/blocklayered.js @@ -230,11 +230,11 @@ function initLayered() function paginationButton() { $('#pagination a').not(':hidden').each(function () { - if ($(this).attr('href').search('&p=') == -1) { + if ($(this).attr('href').search(/&|\?p=/) == -1) { var page = 1; } 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(/#.*$/, ''); $(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);