I'm working on Typesetter 5.1 and the code of the page gallery_edit_202.js is very different from your suggestions. I tried, but... I need more help, please.
My idea is to have a single gallery (pictures) or a list of galleries (page: Galleries) always ordered from the most recent to the oldest.
If I add a picture to a gallery, it must be always at the first place top left.
In the case of Galleries the order must not to change if I edited one of them.
Thank you again.