Explicit load module 'jquery.tablesorter' instead of use when loaded

The module 'jquery.tablesorter' is already loaded a few lines above.
The previous situation depends on a race-condition of the function is called
or not.

Change-Id: If6777fcc7d9d49604eb78b6d233a32898fc82446
This commit is contained in:
Fomafix 2017-04-20 10:44:27 +02:00
parent 744dd98914
commit 278ae63c04

View file

@ -889,15 +889,16 @@
// Instead of show/hiding, switch the HTML around
// We do this because the sortable tables script styles the first row,
// visible or not
var headerHTML = $( '.wikieditor-toolbar-table-preview-header' ).html(),
var $sortable,
headerHTML = $( '.wikieditor-toolbar-table-preview-header' ).html(),
hiddenHTML = $( '.wikieditor-toolbar-table-preview-hidden' ).html();
$( '.wikieditor-toolbar-table-preview-header' ).html( hiddenHTML );
$( '.wikieditor-toolbar-table-preview-hidden' ).html( headerHTML );
if ( typeof jQuery.fn.tablesorter === 'function' ) {
$( '#wikieditor-toolbar-table-preview, #wikieditor-toolbar-table-preview2' )
.filter( '.sortable' )
.tablesorter();
}
$sortable = $( '#wikieditor-toolbar-table-preview, #wikieditor-toolbar-table-preview2' )
.filter( '.sortable' );
mw.loader.using( 'jquery.tablesorter', function () {
$sortable.tablesorter();
} );
} );
},
dialog: {