From: Leo Koppelkamm Date: Fri, 13 May 2011 15:28:42 +0000 (+0000) Subject: Lazy load tablesorter only when needed. Bug 28946 X-Git-Tag: 1.31.0-rc.0~30248 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=ddfa9de6b996cd3cce3ddc387a9a32604d5306f9;p=lhc%2Fweb%2Fwiklou.git Lazy load tablesorter only when needed. Bug 28946 --- diff --git a/resources/Resources.php b/resources/Resources.php index 05265f0ebb..cbbdb9cca2 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -439,6 +439,9 @@ return array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.metadata.js', 'messages' => array( 'metadata-expand', 'metadata-collapse' ), ), + 'mediawiki.action.view.tablesorting' => array( + 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.tablesorting.js', + ), 'mediawiki.action.watch.ajax' => array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.watch.ajax.js', 'dependencies' => 'mediawiki.util', diff --git a/resources/mediawiki.action/mediawiki.action.view.tablesorting.js b/resources/mediawiki.action/mediawiki.action.view.tablesorting.js new file mode 100644 index 0000000000..09aefc0974 --- /dev/null +++ b/resources/mediawiki.action/mediawiki.action.view.tablesorting.js @@ -0,0 +1,9 @@ +// Lazy load jquery.tablesorter + +( function( $ ) { + if ( $( 'table.sortable' ).length ) { + mw.loader.using( 'jquery.tablesorter', function() { + $( 'table.sortable' ).tablesorter(); + } ); + } +} )( jQuery ); \ No newline at end of file diff --git a/resources/mediawiki.util/mediawiki.util.js b/resources/mediawiki.util/mediawiki.util.js index 7e64225f74..67b7dde393 100644 --- a/resources/mediawiki.util/mediawiki.util.js +++ b/resources/mediawiki.util/mediawiki.util.js @@ -57,9 +57,6 @@ /* Enable CheckboxShiftClick */ $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick(); - /* Enable Tablesorting */ - $( 'table.sortable' ).tablesorter(); - /* Emulate placeholder if not supported by browser */ if ( !( 'placeholder' in document.createElement( 'input' ) ) ) { $( 'input[placeholder]' ).placeholder();