r87987 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87986‎ | r87987 | r87988 >
Date:15:28, 13 May 2011
Author:diebuche
Status:resolved
Tags:
Comment:
Lazy load tablesorter only when needed. Bug 28946
Modified paths:
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js (added) (history)
  • /trunk/phase3/resources/mediawiki.util/mediawiki.util.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.view.tablesorting.js
@@ -0,0 +1,9 @@
 2+// Lazy load jquery.tablesorter
 3+
 4+( function( $ ) {
 5+ if ( $( 'table.sortable' ).length ) {
 6+ mw.loader.using( 'jquery.tablesorter', function() {
 7+ $( 'table.sortable' ).tablesorter();
 8+ } );
 9+ }
 10+} )( jQuery );
\ No newline at end of file
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js
@@ -57,9 +57,6 @@
5858 /* Enable CheckboxShiftClick */
5959 $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick();
6060
61 - /* Enable Tablesorting */
62 - $( 'table.sortable' ).tablesorter();
63 -
6461 /* Emulate placeholder if not supported by browser */
6562 if ( !( 'placeholder' in document.createElement( 'input' ) ) ) {
6663 $( 'input[placeholder]' ).placeholder();
Index: trunk/phase3/resources/Resources.php
@@ -439,6 +439,9 @@
440440 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.metadata.js',
441441 'messages' => array( 'metadata-expand', 'metadata-collapse' ),
442442 ),
 443+ 'mediawiki.action.view.tablesorting' => array(
 444+ 'scripts' => 'resources/mediawiki.action/mediawiki.action.view.tablesorting.js',
 445+ ),
443446 'mediawiki.action.watch.ajax' => array(
444447 'scripts' => 'resources/mediawiki.action/mediawiki.action.watch.ajax.js',
445448 'dependencies' => 'mediawiki.util',

Follow-up revisions

RevisionCommit summaryAuthorDate
r87999Followup to r87987: Actually load the lazy loaderdiebuche15:57, 13 May 2011
r88014Followup to r87987: Remove tablesorter from mw.util dependenciesdiebuche17:48, 13 May 2011

Status & tagging log