mw.htmlform: Fix hiding of the textbox for 'selectorother' fields on page load
[lhc/web/wiklou.git] / resources / src / mediawiki / page / startup.js
1 ( function ( mw, $ ) {
2
3 $( function () {
4 var $diff;
5
6 /**
7 * Fired when wiki content is being added to the DOM
8 *
9 * It is encouraged to fire it before the main DOM is changed (when $content
10 * is still detached). However, this order is not defined either way, so you
11 * should only rely on $content itself.
12 *
13 * This includes the ready event on a page load (including post-edit loads)
14 * and when content has been previewed with LivePreview.
15 *
16 * @event wikipage_content
17 * @member mw.hook
18 * @param {jQuery} $content The most appropriate element containing the content,
19 * such as #mw-content-text (regular content root) or #wikiPreview (live preview
20 * root)
21 */
22 mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ) );
23
24 $diff = $( 'table.diff[data-mw="interface"]' );
25 if ( $diff.length ) {
26 /**
27 * Fired when the diff is added to a page containing a diff
28 *
29 * Similar to the {@link mw.hook#event-wikipage_content wikipage.content hook}
30 * $diff may still be detached when the hook is fired.
31 *
32 * @event wikipage_diff
33 * @member mw.hook
34 * @param {jQuery} $diff The root element of the MediaWiki diff (`table.diff`).
35 */
36 mw.hook( 'wikipage.diff' ).fire( $diff.eq( 0 ) );
37 }
38 } );
39
40 }( mediaWiki, jQuery ) );