Merge "resourceloader: Simplify StringSet fallback"
[lhc/web/wiklou.git] / resources / src / mediawiki.page.ready.js
1 ( function () {
2 mw.hook( 'wikipage.content' ).add( function ( $content ) {
3 var $sortable, $collapsible;
4
5 $collapsible = $content.find( '.mw-collapsible' );
6 if ( $collapsible.length ) {
7 // Preloaded by Skin::getDefaultModules()
8 mw.loader.using( 'jquery.makeCollapsible', function () {
9 $collapsible.makeCollapsible();
10 } );
11 }
12
13 $sortable = $content.find( 'table.sortable' );
14 if ( $sortable.length ) {
15 // Preloaded by Skin::getDefaultModules()
16 mw.loader.using( 'jquery.tablesorter', function () {
17 $sortable.tablesorter();
18 } );
19 }
20
21 // Run jquery.checkboxShiftClick
22 $content.find( 'input[type="checkbox"]:not(.noshiftselect)' ).checkboxShiftClick();
23 } );
24
25 // Things outside the wikipage content
26 $( function () {
27 var $nodes;
28
29 // Add accesskey hints to the tooltips
30 $( '[accesskey]' ).updateTooltipAccessKeys();
31
32 $nodes = $( '.catlinks[data-mw="interface"]' );
33 if ( $nodes.length ) {
34 /**
35 * Fired when categories are being added to the DOM
36 *
37 * It is encouraged to fire it before the main DOM is changed (when $content
38 * is still detached). However, this order is not defined either way, so you
39 * should only rely on $content itself.
40 *
41 * This includes the ready event on a page load (including post-edit loads)
42 * and when content has been previewed with LivePreview.
43 *
44 * @event wikipage_categories
45 * @member mw.hook
46 * @param {jQuery} $content The most appropriate element containing the content,
47 * such as .catlinks
48 */
49 mw.hook( 'wikipage.categories' ).fire( $nodes );
50 }
51
52 $( '#t-print a' ).click( function ( e ) {
53 window.print();
54 e.preventDefault();
55 } );
56 } );
57
58 }() );