User:Manishearth/tabbedPage.js

var prefStarted=false function startPref(page,title,heading){ if(mw.config.get('wgPageName')==page&&document.getElementById("bodyContent")){ document.getElementById("bodyContent").innerHTML="" document.getElementById("firstHeading").innerHTML=heading document.title=title prefStarted=true; } } var sections = 0 function addSection(buttonName,sectionText){ if(!prefStarted){ setTimeout("addSection('"+buttonName+"','"+sectionText+"')",1000) return; }	document.getElementById('preftoc').innerHTML+=""+buttonName+"" document.getElementById('preferences').innerHTML+=""+sectionText+" " sections++ openSection(0) }

function openSection(section){ if(!prefStarted){return} for(i=0;i<sections;i++){ document.getElementById("prefbutton-"+i).className="" document.getElementById("prefsection-"+i).style.display="none" }	document.getElementById("prefbutton-"+section).className="selected" document.getElementById("prefsection-"+section).style.display="" }