MediaWiki:Gadget-autosort.js: Difference between revisions

Undid revision 48971 by Alex (talk)
(Undid revision 48972 by Alex (talk))
Tag: Undo
(Undid revision 48971 by Alex (talk))
Tag: Undo
 
Line 10:
rs.autosort = function () {
mw.loader.using('jquery.tablesorter', function () {
$sortables.oneach("tablesorter-initialized", function () {
var $sortables.each(functionthis = $(this) {,
var $this matched = (' ' + $(this).attr('class') + ' ').match(/autosort=(\d+)[,-]{1}(a|d)/),
matched$sortCol = (' ' + $(this).attrfind('class')> +thead th:nth-child(' ').match(/autosort=(\d+) matched[,-1]{1}(a|d + ')/'),;
if $sortCol = $this.find('> thead th:nth-child(' + matched[12] +=== ')d'); {
if (matched[2] ===// 'd') {descending
// descending$sortCol.click().click();
} else $sortCol.click().click();{
} else {// ascending
// ascending$sortCol.click();
$sortCol.click();}
});
mw.hook('gadget.autosort.sorted').fire($sortables);
});
mw.hook('gadget.autosort.sorted').fire($sortables);
});
});
};
mw.hook('wikipage.content').add(function init() {
if ($('.jquery-tablesorter').length) {
setTimeout(rs.autosort(, 100);
} else {
// tablesorter plugin has not run yet; observe the first