Jump to content

Wikipedia:WikiProject User scripts/Scripts/Re-order menus

From Wikipedia, the free encyclopedia

Add the following to monobook.js:

 function menu_move_to_top(menu_name) {
    menu = document.getElementById(menu_name);
    if (menu) {
       p = menu.parentNode;
       p.removeChild(menu);
       p.insertBefore( menu, p.firstChild );
    }
 }
 addOnloadHook(function (){
    /*
     * Edit the order of this menu_names array to change the order of the toolbox.
     * The names are the ids of the boxes.
     */
    menu_names = [
       "p-search", // search box
       "p-tb", // toolbox
       "p-interaction", // interaction
       "p-navigation", // navigation
       ];
    while ( menu_name = menu_names.pop() ) {
       menu_move_to_top(menu_name);
    }
 });


The menu_names variable sets the order of the menu boxes. For example, moving the search box to the bottom can be done by setting the menu_names variable to:

    menu_names = [
       "p-navigation", // navigation
       "p-interaction", // interaction
       "p-tb", // toolbox
       "p-search", // search box
       ];


--h2g2bob (talk) 13:47, 6 July 2008 (UTC)[reply]


Tested with Works?
Internet Explorer 6.0 Un­known
Internet Explorer 7.0 Un­known
Firefox 2.0 Yes
Firefox 3.0 Yes
Safari Un­known
Opera Un­known
Konqueror 3.5 Yes