557
edits
No edit summary |
No edit summary |
||
| Line 52: | Line 52: | ||
}); | }); | ||
} | } | ||
// Enhanced table sorting for mobile | |||
mw.hook('wikipage.content').add(function($content) { | mw.hook('wikipage.content').add(function($content) { | ||
if (mw.config.get('skin') === 'minerva') { | if (mw.config.get('skin') === 'minerva') { | ||
mw.loader.using('jquery.tablesorter').done(function() { | // Find all tables that should be sortable | ||
var $tables = $content.find('.wikitable, table.sortable'); | |||
if ($tables.length > 0) { | |||
mw.loader.using('jquery.tablesorter').done(function() { | |||
$tables.each(function() { | |||
var $table = $(this); | |||
if (!$table.hasClass('sortable')) { | |||
$table.addClass('sortable'); | |||
} | |||
// Initialize tablesorter with mobile-friendly options | |||
$table.tablesorter({ | |||
theme: 'blue', | |||
headerTemplate: '{content} {icon}', | |||
widgets: ['zebra'], | |||
widgetOptions: { | |||
zebra: ["even", "odd"] | |||
} | |||
}); | |||
}); | |||
}); | |||
} | |||
} | } | ||
}); | }); | ||
}); | }); | ||