MediaWiki:Mobile.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
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
            $content.find('.wikitable').addClass('sortable').tablesorter();
        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"]
                        }
                    });
                });
            });
        }
     }
     }
});
});
});
});

Navigation menu