Merge "ApiSandbox: Move labels outside progress bars"
[lhc/web/wiklou.git] / resources / src / mediawiki.page.startup.js
1 ( function () {
2 // Break out of framesets
3 if ( mw.config.get( 'wgBreakFrames' ) ) {
4 // Note: In IE < 9 strict comparison to window is non-standard (the standard didn't exist yet)
5 // it works only comparing to window.self or window.window (http://stackoverflow.com/q/4850978/319266)
6 if ( window.top !== window.self ) {
7 // Un-trap us from framesets
8 window.top.location.href = location.href;
9 }
10 }
11
12 $( function () {
13 var $diff;
14
15 /**
16 * Fired when wiki content is being added to the DOM
17 *
18 * It is encouraged to fire it before the main DOM is changed (when $content
19 * is still detached). However, this order is not defined either way, so you
20 * should only rely on $content itself.
21 *
22 * This includes the ready event on a page load (including post-edit loads)
23 * and when content has been previewed with LivePreview.
24 *
25 * @event wikipage_content
26 * @member mw.hook
27 * @param {jQuery} $content The most appropriate element containing the content,
28 * such as #mw-content-text (regular content root) or #wikiPreview (live preview
29 * root)
30 */
31 mw.hook( 'wikipage.content' ).fire( $( '#mw-content-text' ) );
32
33 $diff = $( 'table.diff[data-mw="interface"]' );
34 if ( $diff.length ) {
35 /**
36 * Fired when the diff is added to a page containing a diff
37 *
38 * Similar to the {@link mw.hook#event-wikipage_content wikipage.content hook}
39 * $diff may still be detached when the hook is fired.
40 *
41 * @event wikipage_diff
42 * @member mw.hook
43 * @param {jQuery} $diff The root element of the MediaWiki diff (`table.diff`).
44 */
45 mw.hook( 'wikipage.diff' ).fire( $diff.eq( 0 ) );
46 }
47 } );
48
49 }() );