]> git.plutz.net Git - serve0/blobdiff - pages/list.sh
correct anchors in thumb list
[serve0] / pages / list.sh
index fc4ff66ceab3d8508be5deabc876b4661f4773f2..70859d51c1207b266d598b6a9a97761b7ac2581a 100755 (executable)
@@ -39,25 +39,12 @@ else
   TITLE="List by $order"
 fi
 
-quicklinks(){
-  output=''
-  tac ${_DATA}/meta/recent \
-  | while [ "$(printf %s "$output" |wc -l)" -lt 30 ] && read line; do
-    printf %s "$output" |grep -qF "$line" || output="$output$line$LF"
-  done 
-  printf %s "$output" |while read line; do
-    linef=$(printf %s "$line" |sed -r 's;^.*(\?|&)f=([^&]+)&?.*$;\2;g')
-    lineo=$(printf %s "$line" |sed -r 's;^.*(\?|&)o=([^&]+)&?.*$;\2;g')
-    printf '<input type="checkbox"><a href="%s">by %s: %s</a>' "$line" "${lineo}" "$(present_filter "$linef")"
-  done
-}
-
 category_selected(){
   cat="${1}:"
   filter="$2"
   [ "$cat" = "none:" ] && cat=''
 
-  printf %s "$taglist" \
+  printf %s "$taglist_filter" \
   | sed -r 's;^('"$filter"')$;1 &;;t;s;^;0 ;' \
   | sed -rn 's;^(0|1) '"$cat"'([^:]+)$;\1 \2;p' \
   | sed 's;^0 ;<option>;;s;^1 ;<option selected>;;s;$;</option>;'
@@ -86,16 +73,16 @@ _printVideo(){
     thumb="$(urlsafe "thumbs/$info.jpg")"
     linkinfo="$(urlsafe "$info")"
     htmlinfo="$(htmlsafe "$info")"
+    attrinfo="$(attribsafe "$info")"
 
-    [ "$(($length % 60))" -lt 10 ] && minutes="$(($length / 60)):0$(($length % 60))" \
-                                   || minutes="$(($length / 60)):$(($length % 60))"
+    minutes="$(printf "%d:%02d" $(($length / 60)) $(($length % 60)) )"
 
     tee "$cache" <<VIDEOend
-      <li class="thumb">
-        <a class="watchlink" name="${linkinfo}" href="?action=watch&i=${linkinfo}">
+      <li id="$attrinfo" class="thumb">
+        <button class="watchlink" name="${linkinfo}" formaction="?action=watch&i=${linkinfo}">
           <img src="$thumb" alt="Preview not yet available">
-        </a>
-        <h2>${htmlinfo}</h2>
+        </button>
+        <h2><a href="?action=watch&i=${linkinfo}">${htmlinfo}</a></h2>
         
         <input type="checkbox" name="tagsel" value="${htmlinfo}">
         <span class="info property">${minutes}min</span>
@@ -117,7 +104,7 @@ genlist(){
 selectionlist() {
   cachebase="?o=${order}&s=${search//\//}&f=${filter//\//}"
   cache="${_DATA}/cache/${cachebase}"
-  if [ "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then
+  if [ -s "$cache" -a "$cache" -nt ${_DATA}/videos -a "$cache" -nt ${_DATA}/meta ]; then
     cat "$cache"
   else
     filterex="s;^([0-9]+\t){3}(.+)\n.*$;\2;p"
@@ -154,4 +141,6 @@ thumblist() {
   done
 }
 
-pagecount="$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+pagecount() {
+  printf "$(( $(selectionlist | wc -l) / $pagesize + 1 ))"
+}