Jump to content

User:Dcoetzee/Gadget-DropdownToTabbar.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
 * Convert Vector portlets menus to tabs.
 *
 * @source: http://www.mediawiki.org/wiki/Snippets/Convert_vectorMenu_to_vectorTabs
 * @rev: 3
 * @author: Edokter
 */

$(document).ready( function() {
    if ( mw.config.get( 'skin' ) == 'vector' ) {
        $( '#p-cactions' )
            .removeClass( 'vectorMenu' )
            .addClass( 'vectorTabs' )
            .css( 'margin-left', '0.5em' )
            .find( 'div.menu > ul' )
                .unwrap()
            .find( 'li > a' )
                .wrap( '<span></span>' );
    }
} );