From: Anders S. Mortensen Date: Wed, 10 Jan 2007 09:50:57 +0000 (+0000) Subject: Improved pager. X-Git-Tag: before.append.child X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=f78b3fcf9a7f403cd5382470c99086db29c03053;p=pazpar2-moved-to-github.git Improved pager. --- diff --git a/www/demo/search.js b/www/demo/search.js index 054558c..4c95499 100644 --- a/www/demo/search.js +++ b/www/demo/search.js @@ -1,4 +1,4 @@ -/* $Id: search.js,v 1.10 2007-01-10 09:19:05 sondberg Exp $ +/* $Id: search.js,v 1.11 2007-01-10 09:50:57 sondberg Exp $ * --------------------------------------------------- * Javascript container */ @@ -147,9 +147,14 @@ function update_action (new_action) { function make_pager (hits, offset, max) { var html = ''; var off; + var start_offset = offset - page_window * max; - for (off = offset - page_window * max; - off < hits && off < (offset + page_window * max); + if (start_offset < 0) { + start_offset = 0; + } + + for (off = start_offset; + off < hits && off < (start_offset + 2 * page_window * max); off += max) { var class = '';