gplx/mediawiki/extensions/SemanticMediaWiki/res/smw/ext.smw.factbox.js

18 lines
426 B
JavaScript

/**
* Initalize sortable table using jquery.tablesorter for factbox attachments
* For some reason just adding the sortable class is not enough to trigger the script
*
* @returns void
*/
function init() {
const attachments = document.getElementById( 'smw-factbox-attachments' );
if ( !attachments ) {
return;
}
mw.loader.using( 'jquery.tablesorter' ).then( () => {
$( attachments ).tablesorter();
} );
}
init();