User:LarryRawr/monobook.js

function purge {//Here, we declare the function and it's parameters var hist; var url;//Here, we declare two variables if (!(hist = document.getElementById('ca-history') )) return;	//Try to set hist as the document's element //with id 'ca-history' - tha's the history tab if (!(url = hist.getElementsByTagName('a')[0] )) return;	//Try to set url as the history tab's first //element with the tag 'a'	if (!(url = url.href )) return;	//Try to set url as the href of that element from line 3 addPortletLink('p-cactions',	//add a PortletLink to the p-cactions area (the tabs at the top of the page)			url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),	//replace the ?action=history											//part of the href we got from											//the history tab with ?action=purge,											//and set it as the destination			'purge',				//set the text that will appear on the tab			'ca-purge',				//set the internal id for the tab - this is useful for								//referring to it, and positioning tabs relative to one another			'Purge server cache for this page',	//set the mouseover text			'0');					//I forget what this does } if ( wgCanonicalNamespace != "Special" ) addOnloadHook(purge);	//if it's not a special page then hook onto the page loading //and run the function purge

// ================================================== //	Collapsible Portlets (experimental) // ==================================================

function foldingPortlets {	var portlets = getElementsByClassName(document.getElementById('column-one'),'div','portlet'); var portskip = ['p-personal', 'p-cactions', 'p-logo', 'ads-top-left', 'p-search', 'p-tbx', 'p-wikicities-nav', 'p-lang']; var first=true;

for(var i=0;i<portlets.length;i++) {		if(portskip.join(' ').indexOf(portlets[i].id)==-1) {			var pd = portlets[i].getElementsByTagName('div')[0]; var ph = portlets[i].getElementsByTagName('h5')[0]; ph.className = 'portletCollapsible' pd.setAttribute('id','pbody-'+i); pd.style.display='none';

var link = document.createElement('a'); var head = getAllText(ph); while(ph.firstChild) ph.removeChild(ph.firstChild); link.appendChild(document.createTextNode(head)); link.setAttribute('href','javascript:showPortlet(\'' + i + '\');'); link.setAttribute('id','plink-'+i); link.className = 'portletClosed'; ph.appendChild(link);

if(first==true) {				first=false; showPortlet(i); }		}	} } if(skin=='monobook'&&!window.portletsNormal) addOnloadHook(foldingPortlets)

function getAllText(thing) {	if (thing.nodeType == 3) return thing.nodeValue; var text = new Array; var i=0; while(thing.childNodes[i]) {		text[text.length] = getAllText(thing.childNodes[i]); i++; }	return text.join(''); }

function showPortlet(id) {	var pd = document.getElementById('pbody-'+id); var pl = document.getElementById('plink-'+id);

if(pd.style.display=='none') {		pd.style.display='block'; pl.className = 'portletOpened'; }	else {		pd.style.display='none'; pl.className = 'portletClosed'; } }

// ================================================== //	End Collapsible Portlets // ================================================== Retrieved from "http://clubpenguin.wikia.com/wiki/User:Zapwire/monobook.js" Improve Club Penguin Wiki by editing this page Zapwire made an edit on August 8, 2009 History Related changes Permanent link What links here