REMOVA OS ANÚNCIOS!

Apoiando através de https://apoia.se/arddhu a partir do tier de Apoiador, você pode navegar na wiki sem anúncios e ainda colabora com o projeto!

MediaWiki:Common.js: mudanças entre as edições

De Runarcana Wiki
Sem resumo de edição
Sem resumo de edição
Linha 6: Linha 6:
/* Tabela */
/* Tabela */


$(document).ready(function() {
$( document ).ready( function() {
     mw.loader.using( 'oojs-ui-core' ).then( function () {
     mw.loader.using( 'oojs-ui-core' ).then( function () {
    var sortTable = function () {
        var sortTable = function () {
        var $table = $( '.organize:not(.wikitable)' );
            var $table = $( '.organize:not(.wikitable)' );
        var $rows = $table.find( 'tr' );
            var $rows = $table.find( 'tr' );
        $rows.sort( function( a, b ) {
            $rows.sort( function( a, b ) {
            var keyA = $(a).find( 'td' ).text().toUpperCase();
                var keyA = $(a).find( 'td' ).text().toUpperCase();
            var keyB = $(b).find( 'td' ).text().toUpperCase();
                var keyB = $(b).find( 'td' ).text().toUpperCase();
            if ( keyA < keyB ) return -1;
                if ( keyA < keyB ) return -1;
            if ( keyA > keyB ) return 1;
                if ( keyA > keyB ) return 1;
            return 0;
                return 0;
        });
            });
        $table.append( $rows );
            $table.append( $rows );
    };
        };
    OO.ui.debounce(sortTable, 250).execute();
        OO.ui.throttle(sortTable, 250).execute();
     });
     });
});
});

Edição das 12h51min de 12 de janeiro de 2023

/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki */

mw.loader.load( 'https://wiki.runarcana.org/util/ptoc.css', 'text/css' );
mw.loader.load( 'https://wiki.runarcana.org/util//ptoc.js', 'text/javascript' );

/* Tabela */

$( document ).ready( function() {
    mw.loader.using( 'oojs-ui-core' ).then( function () {
        var sortTable = function () {
            var $table = $( '.organize:not(.wikitable)' );
            var $rows = $table.find( 'tr' );
            $rows.sort( function( a, b ) {
                var keyA = $(a).find( 'td' ).text().toUpperCase();
                var keyB = $(b).find( 'td' ).text().toUpperCase();
                if ( keyA < keyB ) return -1;
                if ( keyA > keyB ) return 1;
                return 0;
            });
            $table.append( $rows );
        };
        OO.ui.throttle(sortTable, 250).execute();
    });
});

/* Lista */
$(document).ready(function() {
    $(".organiza_lista").each(function() {
        var list = $(this);
        var items = list.find("li");
        items.sort(function(a, b) {
            return $(a).text().localeCompare($(b).text());
        });
        list.html("");
        items.each(function() {
            list.append($(this));
        });
    });
});