From bef200b4669f058ce43ec9c0a3583de7fac558e3 Mon Sep 17 00:00:00 2001 From: Andinus Date: Fri, 10 Jun 2022 23:13:14 +0530 Subject: Add alt tags to images, fix flash of unstyled content - FOUC: On firefox, maybe the '@import' rule caused this. Also tried out lightGallery.js for lightbox, it doesn't work with text & anyways, it's buggy with bricks.js & you have to request license key. --- lib/Crater/Gallery.rakumod | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Crater/Gallery.rakumod') diff --git a/lib/Crater/Gallery.rakumod b/lib/Crater/Gallery.rakumod index ea92c47..19b0d69 100644 --- a/lib/Crater/Gallery.rakumod +++ b/lib/Crater/Gallery.rakumod @@ -3,13 +3,16 @@ class Crater::Gallery { method list() { my @gallery; - for dir($!directory).sort(*.modified) { + for $!directory.dir.sort(*.modified) { if .IO.d { } elsif .IO.f { my Str $ext = .extension.lc; if $ext eq "jpg"|"png" { - push @gallery, %( :type, :src($_.relative($!directory)) ); + push @gallery, %( + :type, :src($_.relative($!directory)), + :alt($_) + ); } elsif $ext eq "0" { push @gallery, %( :type, :text($_.slurp) ); } elsif $ext eq "txt" { @@ -19,7 +22,6 @@ class Crater::Gallery { } } } - return @gallery; } } -- cgit 1.4.1-2-gfad0