Gallery Code
The code for rendering user galleries is very complex. Some details here in case I forget them (as has happened before...)
Element ID standards
Gallery elements all conform to the following element ID standard:
${prefix}gallery-image-${elementName}-${userArtworkID}
- Prefix: a prefix defined for a given gallery. The default gallery has an empty string prefix; other galleries have prefixes to allow them to be distinguished from the default gallery, such as album galleries.
- Element name: the name of the element, such as nsfw-overlay or similar.
- User artwork ID: the internal ID of the artwork, i.e. an integer.
Dynamic resizing
The gallery code notes the aspect ratio of each image in a given gallery, and uses this to arrange images in neat rows of fixed width by adjusting the row height.
Event Propagation
Stopping event propagation is enabled on some elements, to prevent clicks on e.g. an NSFW overlay heading to the artwork link.