Tiled Gallery: Don't wait for all images to load.

No need to wait for all images to load since we know their dimensions to begin with.
Tiled Gallery: JS object represents one gallery.

Refactored the Tiled Gallery prototype to represent a single tiled gallery as the name implies, and added a separate prototype to represent a collection of tiled galleries. This way it's clear which operations are done for individual galleries and which are done for all.
Tiled Gallery: Less responsibility for resize.

Extracted original-width and original-height attribute setting out of the resize function, and moved the call from resize to the constructor, since there is no need to see if the attributes are set in every resize call.
Tiled Gallery: Refactoring maybeSetSizeAttributes.

Made small changes to refactor the logic in maybeSetAttributes, since it was unnecessarily verbose.
Tiled Gallery: Image dimensions to style attribute

Added image height and width attributes to a style attribute so that jQuery width and height accessors can access them before the image is loaded. Image height and width properties are mangled before rendering, so setting them doesn't make the browser reserve the required space before the image is loaded.
Tiled Gallery: Browser backwards compatibility.

Using jQuery foreach instead of standard foreach for browser backwards compatibility.
Tiled Gallery: Removed unnecessary semicolon.
Tiled Gallery: Fix comment indent.
Tiled Gallery: Fixed margin property.
Tiled Gallery: Got rid of maybeSetAttributes.

Having to set data attributes describing image dimensions manually in JavaScript is troublesome, especially since the code rendering the  HTML template knows the exact dimensions. Original image dimensions are now set to the images and tiled gallery rows and groups in the template, so that the JavaScript resizing logic can use them immediately.
Photon: Don't mangle wanted img tag attributes.

Before Photon would mangle data attributes that just contain the substring height or width. This is not wanted, so the regex that cuts out the attributes now makes sure that the substring height or width is preceded by a whitespace.
Tiled Gallery: Rename image data attributes.

Renamed image dimension data attributes to contain width instead of wide and height instead of high, since they are no longer mangled by Photon.
Tiled Gallery: Remove "unresized" class only once.

Before the unresized class was removed on every resize. Actually it needs to be done only once, so it was moved below the first resize call in the TiledGallery constructor.
Tiled Gallery: Added comments.

Added some comments to describe why resizing needs to take certain css dimensions into account.
Tiled Gallery: Indent JS module contents.
Photon: Fix recalc_dims with lazy loaded imgs.

Dimension recalculation of images would incorrectly set width and height to placeholder image dimensions in lazy loaded images. For lazily loaded images there is a need to wait for the src attribute to be updated to the data-lazy-src attribute's value.
Photon: No more arguments.callee.

Using arguments.callee should be avoided, since it is by now deprecated. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments/callee#Why_was_arguments.callee_removed_from_ES5_strict_mode.3F.
Tiled Gallery: Only setup new galleries on events.

Previously all Tiled Galleries would be found and set up again if any new galleries could appear through, e.g., an Infinite Scroll event. Now we only look for new galleries, and don't reinitialize the existing ones, so that we also don't set multiple copies of the hover effect (for captions).
Tiled Gallery: Updated comments.

Removed an old comment and enhanced the wording in another.
Tiled Gallery: More whitespace.