In the course of #5387, all code in session.js, menu.js and messages.js that is logically independent is moved to separate files.
As such, the message boxes that pop up when being defeated, when the replay ended, when the replay went out of sync or when the networked state went out of sync
are moved into classes that subscribe themselves to the according events, rather than hardcoding them in the event handlers.
Aside from the decoupling in session.js, session.xml, messages.js and object notation, there is another benefit in this patch:
The pausegame / closeopendialogs calls when opening a message box, and the resume call when closing the box
are now deduplicated by introducing a new type SessionMessageBox that is inherited by all message boxes in the session.
This has the advantage that the reader doesn't notice this pattern only by chance after reading multiple message boxes but the pattern is manifested in a class.
Prospect: In case someone has enough lifetime to rewrite the entire GUI to use object orientation and not only some pages,
then the other message boxes may use a MessageBox class instead of the messageBox procedure.