User:D-day/monobook.js

//Add sidebar links (User:Jsimlo/shortcuts.js) function shortcutsStartSection (name) {  shortcutsLinks[shortcutsLinks.length] = { 'name': name, 'links': new Array  }; }

function shortcutsAddLink (name, article) {  var links = shortcutsLinks[shortcutsLinks.length - 1]['links'];

links[links.length] = { 'name': name, 'article': article }; }

function shortcutsMakeLink (name, url) {  var ntxt = document.createTextNode (name); var na  = document.createElement ('a'); var nli = document.createElement ('li');

na.setAttribute ('href', '/wiki/' + url); nli.setAttribute ('class', 'n-shortcut');

na.appendChild (ntxt); nli.appendChild (na);

return nli; }

function shortcutsMakePortlet (name, links) {  var nportlet = document.createElement ('div'); var nh5 = document.createElement ('h5'); var ntit = document.createTextNode (name); var nbody = document.createElement ('div'); var nul = document.createElement ('ul');

if (skin == 'vector') { nportlet.setAttribute ('id', 'p-'+name); nportlet.setAttribute ('class', 'portal'); nh5.setAttribute ('xml:lang', 'en'); nh5.setAttribute ('lang', 'en'); nbody.setAttribute ('class', 'body'); } else { nportlet.setAttribute ('id', 'p-'+name); nportlet.setAttribute ('class', 'portlet'); nbody.setAttribute ('class', 'pBody'); nul.setAttribute ('id', 'p-'+name); }

for (var i = 0; i < links.length; i++) nul.appendChild (      shortcutsMakeLink (links[i]['name'], links[i]['article'])     );

nh5.appendChild (ntit); nportlet.appendChild (nh5); nbody.appendChild (nul); nportlet.appendChild (nbody);

return nportlet; }

function shortcutsMain {  if (skin == 'vector') { var sidecol = document.getElementById ('panel'); } else { var sidecol = document.getElementById ('column-one'); }

for (var i = 0; i < shortcutsLinks.length; i++) if (shortcutsLinks[i]['links'].length > 0) sidecol.appendChild (        shortcutsMakePortlet (shortcutsLinks[i]['name'], shortcutsLinks[i]['links'])       ); }

function shortcutsInitialize {  shortcutsInit ; shortcutsMain ; }

var shortcutsLinks = new Array ; shortcutsStartSection (wgUserName ? wgUserName : 'shortcuts');

addOnloadHook (shortcutsInitialize);

function shortcutsInit {  shortcutsStartSection ('Site maintenance');

shortcutsAddLink ( 'Delete', 'Candidates_for_deletion' ); shortcutsAddLink ( 'Speedy', 'Candidates_for_speedy_deletion' ); shortcutsAddLink ( 'Stubs', 'Article_stubs' ); shortcutsAddLink ( 'Move', 'Category:Candidates_for_moving' ); shortcutsAddLink ( 'Merge', 'Category:Candidates_for_merge' ); shortcutsAddLink ( 'Uncategorized', 'Category:Uncategorized_pages' ); shortcutsAddLink ( 'Clean up', 'Category:Articles_requiring_clean_up' ); shortcutsAddLink ( 'Picture', 'Category:Articles_requiring_pictures' ); shortcutsAddLink ( 'More...', 'Category:Site_maintenance' ); }

//Reorder sidebar 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 {

menu_names = [ "p-search", // search box "p-tb", // toolbox "p-personal", // personal "p-Navigation", // navigation "p-Dragon_Age", // dragon age "p-Site maintenance", // site maintenance "p-Community", // community ];   while ( menu_name = menu_names.pop ) { menu_move_to_top(menu_name); } });