MediaWiki talk:Common.js

MediaWiki YUI TabView
The original code, ( included below for reference ), called the script with div class="tabview".

The code has since been altered to use div class="divview" to reduce confusion for new editors on this Wiki.

The syntax uses divs with the 'divview' class, and uses the title of the children divs to act as tabs. So an example would be:

Tab 1 content. Tab 2 content.

Because the childNodes variable is used instead of using getElementsByTagName it is also theoretically possible to put tab systems inside of other tab systems.

Original Code
Original code from: http://anime.wikia.com/index.php?title=MediaWiki:TabView.js addOnloadHook(initTabview); function initTabview { var start = document.getElementById( 'bodyContent' ); if( !start ) start = document.getElementById( 'content' ); if( !start ) start = document.getElementById( 'c-content' ); if( !start ) start = document.getElementsByTagName( 'body' )[0]; if( !start ) start = document; var container = 0; var containers = YAHOO.util.Dom.getElementsByClassName( 'tabview', 'div', start ); for( var c = 0; c < containers.length; c++ ) { container++ if( !containers[c].id ) containers[c].id = 'YUI_TAB_ID_' + container; var tabView = new YAHOO.widget.TabView({ id: 'YUI_TAB_CONTAINER_' + container }); YAHOO.util.Event.onContentReady(containers[c].id, function {			for( var t = 0; t < this.childNodes.length; t++ ) {				if( this.childNodes[t].tagName && this.childNodes[t].tagName.toLowerCase == 'div' ) {					tabView.addTab( new YAHOO.widget.Tab({						label: this.childNodes[t].title,						content: this.childNodes[t].innerHTML					}));				}			}			tabView.set('activeIndex', 0); // make first tab active			tabView.appendTo(this.parentNode, this);			this.parentNode.removeChild(this);		}); } }