mason/dhandler: Add a `license' relationship to the AGPL link.
[tgal] / mason / dhandler
index 7d76fdf..24b5026 100755 (executable)
@@ -82,6 +82,16 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
            urlencode "$SCRIPTURL/$uplink";
        }
        (my $nosl = $path) =~ s!/$!!;
+
+       my %tn;
+       for my $f (@$ff)
+         { $tn{$f} = TrivGal::Image->new($path . $f->name); }
+       for my $d (@$dd) {
+         my ($ddd, $fff, $iii) = listdir $real . "/" . $d->name;
+         $tn{$d} = $iii ?
+           TrivGal::Image->new(join_paths $path, $d->name, $iii->name) :
+           undef;
+       }
 </%perl>
 %
 <&| .html, title => "Folder " . $m->interp->apply_escapes($nosl || "[top]", "h"),
@@ -97,29 +107,28 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 %
 % if (@$dd) {
 <h2>Subfolders</h2>
-<div class=gallery>
-%   for my $d (@$dd) {
-%     my ($ddd, $fff, $iii) = listdir $real . "/" . $d->name;
-%     my $tn = $iii ?
-%      TrivGal::Image->new(join_paths $path, $d->name, $iii->name) :
-%       undef;
+%   for my $size (qw{medthumb}) {
+<div class="gallery <% $size %>">
+%     for my $d (@$dd) {
   <& .thumbnail, target => $d->name . "/", comment => $d->comment,
-                img => $tn, size => "bigthumb",
+                img => $tn{$d}, size => $size,
                 caption => $m->interp->apply_escapes($d->name, "h") &>\
-%   }
+%     }
 </div>
+%   }
 % }
 %
 % if (@$ff) {
 <h2>Images</h2>
-<div class=gallery>
-%   for my $f (@$ff) {
+%   for my $size (qw{medthumb}) {
+<div class="gallery <% $size %>">
+%     for my $f (@$ff) {
   <& .thumbnail, target => $f->name, comment => $f->comment,
-                img => TrivGal::Image->new($path . $f->name),
-                size => "bigthumb",
+                img => $tn{$f}, size => "bigthumb",
                 caption => $m->interp->apply_escapes($f->name, "h") &>\
-%   }
+%     }
 </div>
+%   }
 % }
 %
 <div class=fill></div>
@@ -190,14 +199,16 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 % }
 </div>
 %
-<div class=thumbstrip>
-% for my $f (@$ff) {
-%   my $img = TrivGal::Image->new($dir . "/" . $f->name);
-  <& .thumbnail, target => $f->name, img => $img, size => "bigthumb",
+% my %img = map { $_ => TrivGal::Image->new($dir . "/" . $_->name) } @$ff;
+% for my $size (qw{smallthumb medthumb bigthumb}) {
+<div class="thumbstrip <% $size %>">
+%   for my $f (@$ff) {
+  <& .thumbnail, target => $f->name, img => $img{$f}, size => $size,
                 caption => $m->interp->apply_escapes($f->name, "h"),
                 focus => $f->name eq "$base$ext" &>\
-% }
+%   }
 </div>
+% }
 <& .footer, path => $dir &>
 </&>
 %
@@ -240,7 +251,7 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 % if (defined $img) { $tn = $img->scale($size); }
 % else { $tn = "$STATICURL/folder.svg"; }
 % if ($focus) {
-  <figure class="thumb <% $size %>" id=focusthumb>
+  <figure class="thumb focusthumb <% $size %>">
     <img class="thumb <% $size %>" load=lazy src="<% $tn |u %>">
     <figcaption><span class=name><% $caption %></span></figcaption>
 % } else {
@@ -277,7 +288,7 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
     Trivial Gallery, copyright &copy; 2021 Mark Wooding.
     Free software: you can modify it and/or redistribute it under the
     terms of the
-    <a href="https://www.gnu.org/licenses/agpl-3.0.en.html">GNU Affero
+    <a rel=license href="https://www.gnu.org/licenses/agpl-3.0.en.html">GNU Affero
     General Public License version 3</a>.
     Browse or download
     the <a href="https://git.distorted.org.uk/~mdw/tgal/">source code</a>.