$modules['content'][] = 'jquery.tablesorter';
}
+ // Preload jquery.makeCollapsible for mediawiki.page.ready
+ if ( strpos( $out->getHTML(), 'mw-collapsible' ) !== false ) {
+ $modules['content'][] = 'jquery.makeCollapsible';
+ }
+
// Add various resources if required
if ( $wgUseAjax && $wgEnableAPI ) {
if ( $wgEnableWriteAPI && $user->isLoggedIn()
}
mw.hook( 'wikipage.content' ).add( function ( $content ) {
- var $sortable;
+ var $sortable, $collapsible;
// Run jquery.placeholder polyfill if placeholder is not supported
if ( !supportsPlaceholder ) {
$content.find( 'input[placeholder]' ).placeholder();
}
- // Run jquery.makeCollapsible
- $content.find( '.mw-collapsible' ).makeCollapsible();
+ $collapsible = $content.find( '.mw-collapsible' );
+ if ( $collapsible.length ) {
+ // Preloaded by Skin::getDefaultModules()
+ mw.loader.using( 'jquery.makeCollapsible', function () {
+ $collapsible.makeCollapsible();
+ } );
+ }
$sortable = $content.find( 'table.sortable' );
if ( $sortable.length ) {