There doesn't seem to be an easy way to preload images in #Elm. This might get ugly.
The image preload code turned out kinda ugly indeed, but the overal result is nonetheless pretty nice.
The gallery viewer at https://v3.vndb.org/v3 is now written in #Elm
Source: https://g.blicky.net/vndb.git/tree/elm/Lightbox.elm?id=650404f87And the rather ugly supporting JS: https://g.blicky.net/vndb.git/tree/static/f/vndb.js?id=650404f87#n100
The image preload code turned out kinda ugly indeed, but the overal result is nonetheless pretty nice.
The gallery viewer at https://v3.vndb.org/v3 is now written in #Elm
Source: https://g.blicky.net/vndb.git/tree/elm/Lightbox.elm?id=650404f87
And the rather ugly supporting JS: https://g.blicky.net/vndb.git/tree/static/f/vndb.js?id=650404f87#n100