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 9: Linha 9:
     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(.organize table)' );
             var $table = $( '.organize:not(.wikitable):not(.organize table):not(tr table)' );
             var $rows = $table.find( 'tr' );
             var $rows = $table.find( 'tr' );
             $rows.sort( function( a, b ) {
             $rows.sort( function( a, b ) {

Edição das 13h05min 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):not(.organize table):not(tr table)' );
            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 );
        };
        var throttledSort = OO.ui.throttle(sortTable, 250);
        throttledSort();
    });
});


/* 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));
        });
    });
});