User:Smurf/monobook.js

// function addPortlet(name,options) {	var id = "p-" + name.replace(/ /g,"-").replace(/[^A-Za-z0-9:_.-]/g,""), before = ""; if (typeof options == "object") {		id = options.id || id; before = options.before || before; }	var sidebar = document.getElementById("column-one"); var portlet = document.createElement("div"); portlet.setAttribute("class","portlet"); portlet.setAttribute("id",id); var head = document.createElement("h5"); head.appendChild(document.createTextNode(name)); var body = document.createElement("div"); body.setAttribute("class","pBody"); body.appendChild(document.createElement("ul")); portlet.appendChild(head); portlet.appendChild(body); return sidebar.insertBefore(portlet, document.getElementById(before)); }

function PreviewSkinPortlet {	var skins = new Array("chick","cologneblue","modern","monobook","myskin","nostalgia","simple","standard"); addPortlet('Preview Skin',{id:'p-skins'}); for (var i=0; i<skins.length; i++) {		if (skin == skins[i]) addPortletLink('p-skins','/wiki/'+wgPageName,skins[i]); else addPortletLink('p-skins','/wiki/'+wgPageName+'?useskin='+skins[i],skins[i]); } }

var timerDisplay = false; function runOnload { // Non-redirecting image links var links = document.getElementsByTagName("a"); for (var i=0; i<links.length; i++) if (links[i].href.indexOf("http://wiki.guildwars.com/wiki/Image:")==0) links[i].href += "?redirect=no"; PreviewSkinPortlet; addPortletLink("p-navigation","http://players.guildwars.com/","GuildWars.com"); addPortletLink("p-personal","/wiki/User:Smurf/Sandbox","My Sandbox",null,null,null,document.getElementById('pt-preferences')); // Logs link if ( wgCurRevisionId==false ) addPortletLink("p-cactions","/wiki/Special:Log?page="+wgPageName,"Logs","ca-log",null,null,document.getElementById('ca-log')); addPortlet('My Toolbox',{before:'p-tb'}); addPortletLink("p-My-Toolbox","http://validator.w3.org/check?uri=" + encodeURIComponent(window.location),"Validate"); addPortletLink("p-My-Toolbox","#","640x","M-640x").onmousedown = function{document.body.style.width='620px';}; addPortletLink("p-My-Toolbox","#","800x","M-800x").onmousedown = function{document.body.style.width='780px';}; addPortletLink("p-My-Toolbox","#","1024x","M-1024x").onmousedown = function{document.body.style.width='1004px';}; addPortletLink("p-My-Toolbox","#","Auto","M-Auto").onmousedown = function{document.body.style.width='auto';}; // Game link var rdfrom = window.location.toString.match( /(?:[\?|&]rdfrom=)([^&]*)/ ); if (rdfrom && rdfrom.length > 1) addPortletLink("p-My-Toolbox",unescape(rdfrom[1]),"Game link");

// Hide preview note for comparisons if ( document.getElementById('wikiPreview') ) { var hprev = addPortletLink("p-My-Toolbox","#","Hide preview note",null,null,null,document.getElementById('t-hprev')); hprev.onmousedown = function { document.getElementById('wikiPreview').className = "hidePreview"; hprev.parentNode.removeChild(hprev); };	}

// Game link preload edit box if (wgNamespaceNumber==102 && wgCurRevisionId==false) document.getElementById("ca-edit").firstChild.href+="&preload=User:Smurf/Game_link_preload"; } addOnloadHook(runOnload);

//