Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
Tag: Manual revert
No edit summary
Tag: Manual revert
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// Sort categories alphabetically by the first character after the colon
$(function() {
    var $categories = $('.mw-normal-catlinks ul li');
    $categories.sort(function(a, b) {
        var textA = $(a).text().toUpperCase();
        var textB = $(b).text().toUpperCase();
        var charA = textA.match(/:(.)/)[1];
        var charB = textB.match(/:(.)/)[1];
        return (charA < charB) ? -1 : (charA > charB) ? 1 : 0;
    });
    $('.mw-normal-catlinks ul').empty().append($categories);
});

Latest revision as of 02:12, 11 May 2024

/* Any JavaScript here will be loaded for all users on every page load. */