X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=list.sh;h=98305c94f1f6a2a0e8cf2d71f6e3b58b5d6d0c6a;hb=b0cfee07ebebf399963569086924b13fe0a8a335;hp=f36fe67fe13fa969677195f9152b225fcb1cdf6b;hpb=2515c4e19a1daf3c166c446ba97979f4bfebed26;p=serve0 diff --git a/list.sh b/list.sh index f36fe67..98305c9 100644 --- a/list.sh +++ b/list.sh @@ -29,7 +29,7 @@ list_item() { name="$(HTML "$ITEM/$name")" printf '[div .list .file [a href="%s" [img src="%s?a=thumbnail"]][label %s] - [span .time %i:%imin] [span .dim %ix%i] %s + [span .time %i:%02imin] [span .dim %ix%i] %s [checkbox "select" "%s" id="select_%s"][label for="select_%s" +] ]' \ "$link" "$link" "${name##*/}" \ @@ -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 ']' }