From b0cfee07ebebf399963569086924b13fe0a8a335 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 26 Oct 2018 22:29:02 +0200 Subject: [PATCH] mark current page in page list --- list.sh | 12 +++++++++--- style.css | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/list.sh b/list.sh index a408af9..98305c9 100644 --- a/list.sh +++ b/list.sh @@ -160,10 +160,16 @@ list_paginate() { done printf ']' + [ $(( c % LISTSIZE )) -gt 0 ] \ + && end=$((c / LISTSIZE + 1)) \ + || end=$((c / LISTSIZE)) + printf '[div .pagination' - for n in $( seq 1 $((c / LISTSIZE + 1)) ); do - printf '[a .page href="%s" %s]' \ - "?p=$(( (n - 1) * LISTSIZE + 1))&${qry}" "$n" + for n in $( seq 1 $end ); do + c=$(( (n - 1) * LISTSIZE + 1 )) + [ $c = $page ] \ + && printf '[a .page .current href="%s" %s]' "?p=${c}&${qry}" "$n" \ + || printf '[a .page href="%s" %s]' "?p=${c}&${qry}" "$n" done printf ']' } diff --git a/style.css b/style.css index b2412a2..25cfb0f 100644 --- a/style.css +++ b/style.css @@ -350,6 +350,11 @@ a[href="#advsearch"]:before { background-color: #FDD; border: 1px solid; } +.page.current { + font-weight: bold; + color: #DAA; + background-color: #000; +} #index label:first-of-type { font-weight: bold; } #index input, #index button { margin-left: 1em;} -- 2.39.2