mw.hook: Implement callback framework
We have various interface components that are extended, enhanced
or manipulated in some other way by extensions, gadgets and even
in core itself.
This framework helps streamlining the timing of when these other
code paths fire their plugins (instead of using document-ready,
which can and should be limited to firing only once).
Features like navigating to other wiki pages, previewing an edit
and editing itself – without a refresh – can then retrigger these
hooks accordingly to ensure everything still works as expected.
For the server side this has been possible already, but for the
client side we've been limited to running only once on the
original page load.
Further documentation and examples are in the code documentation.
Bug: 23580
Bug: 30713
Change-Id: Ic73a3efe53d6fb731e7f1e531d5f51530cd7e4fe