From: David ‘Bombe’ Roden Date: Sat, 16 Apr 2011 11:21:39 +0000 (+0200) Subject: Return page 1 for pages without pagination. X-Git-Tag: 0.6.2^2~11^2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=dbb52371a130df342308472ab7bc2610549f4ed5;p=Sone.git Return page 1 for pages without pagination. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 84208f4..3088aff 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1115,14 +1115,19 @@ function isIndexPage() { } /** - * Returns the current page of the selected pagination. + * Returns the current page of the selected pagination. If no pagination can be + * found with the given selector, {@code 1} is returned. * * @param paginationSelector * The pagination selector * @returns The current page of the pagination */ function getPage(paginationSelector) { - return $(".current-page", paginationSelector).text(); + pagination = $(paginationSelector); + if (pagination.length > 0) { + return $(".current-page", paginationSelector).text(); + } + return 1; } /**