User:BryghtShadow/monobook.js

function ucfirst(string) { return string.charAt(0).toUpperCase + string.slice(1); }

function Skin(name) { var _ui; var _init = function { var link = document.createElement("a"); link.href = window.location.toString.split("?")[0]; if (name) { link.href += "?useskin=" + name; }     link.appendChild(document.createTextNode("["+ucfirst(name?name:"default")+"]")); _ui = document.createElement("span"); _ui.appendChild(link); }  this.getDomElement = function { return _ui; }  _init; }

function SkinSelector { var _ui; var _skins; var _init = function { _skins = []; _skins.push(new Skin); _skins.push(new Skin("oasis")); _skins.push(new Skin("monobook")); _ui = document.createElement("span"); for (var i in _skins) { _ui.appendChild(_skins[i].getDomElement); _ui.appendChild(document.createTextNode(" ")); }     //_ui.setAttribute("style", "border:1px solid grey; padding:3px;"); }  this.getDomElement = function { return _ui; }  _init; } function ShowSkinSelector { var ss = new SkinSelector; var skins = document.createElement("li"); skins.id = "pt-skins"; skins.appendChild(ss.getDomElement); var child1 = document.getElementById("pt-userpage"); if (child) child1.parentNode.insertBefore(skins, child1); } addOnloadHook(ShowSkinSelector);