Merge "Add PreferencesFormPreSave hook"
[mediawiki.git] / resources / mediawiki.page / mediawiki.page.startup.js
blobe3541069d4e280800299a9d041f61f7586b968bd
1 ( function ( mw, $ ) {
3         mw.page = {};
5         // Client profile classes for <html>
6         // Allows for easy hiding/showing of JS or no-JS-specific UI elements
7         $( 'html' )
8                 .addClass( 'client-js' )
9                 .removeClass( 'client-nojs' );
11         $( function () {
12                 // Initialize utilities as soon as the document is ready (mw.util.$content,
13                 // messageBoxNew, profile, tooltip access keys, Table of contents toggle, ..).
14                 // In the domready here instead of in mediawiki.page.ready to ensure that it gets enqueued
15                 // before other modules hook into domready, so that mw.util.$content (defined by
16                 // mw.util.init), is defined for them.
17                 mw.util.init();
19                 /**
20                  * Fired when wiki content is being added to the DOM
21                  *
22                  * It is encouraged to fire it before the main DOM is changed (when $content
23                  * is still detatched).  However, this order is not defined either way, so you
24                  * should only rely on $content itself.
25                  *
26                  * This includes the ready event on a page load (including post-edit loads)
27                  * and when content has been previewed with LivePreview.
28                  *
29                  * @event wikipage_content
30                  * @member mw.hook
31                  * @param {jQuery} $content The most appropriate element containing the content,
32                  *   such as #mw-content-text (regular content root) or #wikiPreview (live preview
33                  *   root)
34                  */
35                 mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ) );
36         } );
38 }( mediaWiki, jQuery ) );