557
edits
(Created page with "→MediaWiki:Common.js Lightweight, mobile-friendly table sortable + responsive + collapsible Works on Vector (desktop) and Minerva (mobile) without depending on core tablesorter: ( function () { →: function wrapTables( $root ) { var $scope = $root.find( '.mw-parser-output' ).addBack( '.mw-parser-output' ); if ( !$scope.length ) $scope = $root; $scope.find( 'table' ).each( function () { var $...") |
No edit summary |
||
| Line 182: | Line 182: | ||
} | } | ||
// Fix table sorting on mobile (Minerva skin) | |||
if ( mw.config.get( 'skin' ) === 'minerva' ) { | |||
mw.hook( 'wikipage.content' ).add( function ( $content ) { | |||
// Load tablesorter for sortable tables | |||
if ( $content.find( '.sortable' ).length ) { | |||
mw.loader.using( 'jquery.tablesorter' ).done( function () { | |||
$content.find( '.sortable' ).tablesorter(); | |||
}); | |||
} | |||
}); | |||
} | |||
/* --- Enhance function runs everything --- */ | /* --- Enhance function runs everything --- */ | ||
function enhance( $content ) { | function enhance( $content ) { | ||
| Line 192: | Line 203: | ||
$( function () { enhance( $( document ) ); } ); | $( function () { enhance( $( document ) ); } ); | ||
mw.hook( 'wikipage.content' ).add( function ( $content ) { enhance( $content ); } ); | mw.hook( 'wikipage.content' ).add( function ( $content ) { enhance( $content ); } ); | ||
} )(); | } )(); | ||