From f78b3fcf9a7f403cd5382470c99086db29c03053 Mon Sep 17 00:00:00 2001 From: "Anders S. Mortensen" Date: Wed, 10 Jan 2007 09:50:57 +0000 Subject: [PATCH] Improved pager. --- www/demo/search.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 = ''; -- 1.7.10.4