User:Alari/monobook.js

function shortcutsInit {  shortcutsAddLink ('My Links', 'User:Alari/links'); shortcutsAddLink ('My Stuff', 'User:Alari/personal'); shortcutsAddLink ('Game Updates', 'Game Updates'); shortcutsAddLink ('Greens', 'Index_of_unique_item_lists'); shortcutsAddLink ('Armor', 'Armor types'); shortcutsAddLink ('Skills', 'Index of skill lists'); shortcutsAddLink ('Policy', 'Guildwiki:Policy'); shortcutsAddLink ('Q&A', 'GuildWiki:Request assistance'); shortcutsAddLink ('New Pages', 'Special:Newpages'); shortcutsAddLink ('Edit Links', 'User:Alari/monobook.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'); 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 {  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);