chiark / gitweb /
static/tgal.js (keyevent): Discard key events with spurious modifiers.
[tgal] / mason / dhandler
index 0c834b9283ec32df41f580918464aeec1b02aa3d..8c151bac19ac249c4b629fc2283febd1b9ae0d4c 100755 (executable)
@@ -83,20 +83,28 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
        }
        (my $nosl = $path) =~ s!/$!!;
 
-       my $size = "medthumb";
+       my @size = ("smallthumb", "medthumb", "bigthumb");
        my %tn;
-       my (%nd, %nf);
-       for my $f (@$ff)
-         { $tn{$f} = TrivGal::Image->new($path . $f->name)->scale($size); }
+       my %count;
+       for my $f (@$ff) {
+         my $img = TrivGal::Image->new($path . $f->name);
+         for my $size (@size) { $tn{$f}{$size} = $img->scale($size); }
+       }
        for my $d (@$dd) {
          my $p = join_paths $path, $d->name;
          my ($ddd, $fff, $iii);
          ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;
-         $nd{$d} = @$ddd; $nf{$d} = @$fff;
+
+         my $count = "";
+         $count .= scalar(@$ddd) . "/" if @$ddd;
+         $count .= scalar(@$fff) if @$fff;
+         $count{$d} = $count;
+
          DIR: for (;;) {
            if (defined $iii) {
              my $index = join_paths $p, $iii->name;
-             $tn{$d} = TrivGal::Image->new($index)->scale($size);
+             my $img = TrivGal::Image->new($index);
+             for my $size (@size) { $tn{$d}{$size} = $img->scale($size); }
              last DIR;
            }
            if (!@$ddd) { $tn{$d} = undef; last DIR; }
@@ -124,28 +132,30 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 %
 % if (@$dd) {
 <h2>Subfolders</h2>
+%   for my $size (@size) {
 <div class="gallery <% $size %>">
-%   for my $d (@$dd) {
-%     my $count = "";
-%     $count .= "$nd{$d}/" if $nd{$d};
-%     $count .= "$nf{$d}" if $nf{$d};
+%     for my $d (@$dd) {
   <& .thumbnail, target => $d->name, comment => $d->comment,
-                tn => $tn{$d}, size => $size,
+                tn => $tn{$d}{$size}, size => $size,
                 caption =>
-                  $m->interp->apply_escapes($d->name, "h") . " [$count]" &>\
-%   }
+                  $m->interp->apply_escapes($d->name, "h") .
+                  " [$count{$d}]" &>\
+%     }
 </div>
+%   }
 % }
 %
 % if (@$ff) {
 <h2>Images</h2>
+%   for my $size (@size) {
 <div class="gallery <% $size %>">
-%   for my $f (@$ff) {
+%     for my $f (@$ff) {
   <& .thumbnail, target => $f->name, comment => $f->comment,
-                tn => $tn{$f}, size => $size,
+                tn => $tn{$f}{$size}, size => $size,
                 caption => $m->interp->apply_escapes($f->name, "h") &>\
-%   }
+%     }
 </div>
+%   }
 % }
 %
 <div class=fill></div>
@@ -277,7 +287,14 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 %
 <div class=viewnav>
 % if ($link{prev}) {
-  <div class=prev><a class=prev href="<% "$pre/$link{prev}" |hu %>">&lsaquo;</a></div>
+  <div class=prev>
+    <a class=nav title="Previous image" href="<% "$pre/$link{prev}" |hu %>">
+      <svg width="50" height="80" viewBox="-25 -40 50 80">
+        <path class="fg" stroke="none"
+             d="m+1,0 +6,-11 -2,-1 -12,+12 +12,+12 +2,-1 z"/>
+      </svg>
+    </a>
+  </div>
 % }
   <a class=view href="<% $url |h %>">
     <picture>
@@ -295,7 +312,14 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
     </picture>
   </a>
 % if ($link{next}) {
-  <div class=next><a class=next href="<% "$pre/$link{next}" |hu %>">&rsaquo;</a></div>
+  <div class=next>
+    <a class=nav title="Next image" href="<% "$pre/$link{next}" |hu %>">
+      <svg width="50" height="80" viewBox="-25 -40 50 80">
+        <path class="fg" stroke="none"
+             d="m-1,0 -6,-11 +2,-1 +12,+12 -12,+12 -2,-1 z"/>
+      </svg>
+    </a>
+  </div>
 % }
 </div>
 %