list_paginate(){
page="$(GET p |grep -xE '[0-9]+' || printf 1)"
+
+ printf '[div .itemlist '
while i="$(line)"; do
c=$((${c-0} + 1))
if [ $c -lt $page ]; then
list_item "$i"
fi
done
+ printf ']'
+ printf '[div .pagination'
for n in $(seq 1 $((c / LISTSIZE + 1)) ); do
printf '[a .page href="%s" %s]' \
- "?p=$(( (n - 1) * LISTSIZE + 1))" "$n" |tee /dev/stderr
+ "?p=$(( (n - 1) * LISTSIZE + 1))" "$n"
done
+ printf ']'
}
printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
max-width: 85%;
}
+.itemlist { overflow: hidden;}
.list {
position: relative;
- display: inline-block;
+ display: block; float: left;
width: 25%;
min-width: 250px;
padding: .5em 1em;
z-index: -2;
content: '';
}
+.list.file:first-of-type { clear: left; }
.list.dir:before { background-color: #CCF; }
.list.file:before { background-color: #FDD; }
display: block;
width: 100%;
}
+.pagination {
+ display: block;
+ text-align: center;
+ margin-top: 1em;
+}
+.page {
+ display: inline-block;
+ padding: .25em .5em;
+ background-color: #FAA;
+ border: 1px solid;
+}
+.page:nth-of-type(1) {clear: left;}