<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://library.hyrulecastle.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3ACommon.js</id>
	<title>MediaWiki:Common.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://library.hyrulecastle.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3ACommon.js"/>
	<link rel="alternate" type="text/html" href="http://library.hyrulecastle.org/index.php?title=MediaWiki:Common.js&amp;action=history"/>
	<updated>2026-05-19T11:18:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://library.hyrulecastle.org/index.php?title=MediaWiki:Common.js&amp;diff=4076&amp;oldid=prev</id>
		<title>Guy: Hopefully this works - adding collapsible table functionality</title>
		<link rel="alternate" type="text/html" href="http://library.hyrulecastle.org/index.php?title=MediaWiki:Common.js&amp;diff=4076&amp;oldid=prev"/>
		<updated>2016-04-15T07:51:28Z</updated>

		<summary type="html">&lt;p&gt;Hopefully this works - adding collapsible table functionality&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/* Any JavaScript here will be loaded for all users on every page load. */&lt;br /&gt;
/**&lt;br /&gt;
 * Collapsible tables&lt;br /&gt;
 *&lt;br /&gt;
 * Allows tables to be collapsed, showing only the header. See [[Wikipedia:NavFrame]].&lt;br /&gt;
 * @maintainer [[User:R. Koot]] (on Wikipedia)&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
var autoCollapse = 2;&lt;br /&gt;
var collapseCaption = &amp;#039;hide&amp;#039;;&lt;br /&gt;
var expandCaption = &amp;#039;show&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
function hasClass( element, className ) {&lt;br /&gt;
	var Classes = element.className.split( &amp;quot; &amp;quot; );&lt;br /&gt;
	for ( var i = 0; i &amp;lt; Classes.length; i++ ) {&lt;br /&gt;
		if ( Classes[i] == className ) {&lt;br /&gt;
			return true;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	return false;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function collapseTable( tableIndex ) {&lt;br /&gt;
	var i;&lt;br /&gt;
	var Button = document.getElementById( &amp;#039;collapseButton&amp;#039; + tableIndex );&lt;br /&gt;
	var Table = document.getElementById( &amp;#039;collapsibleTable&amp;#039; + tableIndex );&lt;br /&gt;
&lt;br /&gt;
	if ( !Table || !Button ) {&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	var Rows = Table.getElementsByTagName( &amp;#039;tr&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
	if ( Button.firstChild.data == collapseCaption ) {&lt;br /&gt;
		for ( i = 1; i &amp;lt; Rows.length; i++ ) {&lt;br /&gt;
			Rows[i].style.display = &amp;#039;none&amp;#039;;&lt;br /&gt;
		}&lt;br /&gt;
		Button.firstChild.data = expandCaption;&lt;br /&gt;
	} else {&lt;br /&gt;
		for ( i = 1; i &amp;lt; Rows.length; i++ ) {&lt;br /&gt;
			Rows[i].style.display = Rows[0].style.display;&lt;br /&gt;
		}&lt;br /&gt;
		Button.firstChild.data = collapseCaption;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function createCollapseButtons() {&lt;br /&gt;
	var i;&lt;br /&gt;
	var tableIndex = 0;&lt;br /&gt;
	var NavigationBoxes = {};&lt;br /&gt;
	var Tables = document.getElementsByTagName( &amp;#039;table&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
	for ( i = 0; i &amp;lt; Tables.length; i++ ) {&lt;br /&gt;
		if ( hasClass( Tables[i], &amp;#039;collapsible&amp;#039; ) ) {&lt;br /&gt;
			NavigationBoxes[ tableIndex ] = Tables[i];&lt;br /&gt;
			Tables[i].setAttribute( &amp;#039;id&amp;#039;, &amp;#039;collapsibleTable&amp;#039; + tableIndex );&lt;br /&gt;
&lt;br /&gt;
			var Button = document.createElement( &amp;#039;span&amp;#039; );&lt;br /&gt;
			var ButtonLink = document.createElement( &amp;#039;a&amp;#039; );&lt;br /&gt;
			var ButtonText = document.createTextNode( collapseCaption );&lt;br /&gt;
&lt;br /&gt;
			Button.style.styleFloat = &amp;#039;right&amp;#039;;&lt;br /&gt;
			Button.style.cssFloat = &amp;#039;right&amp;#039;;&lt;br /&gt;
			Button.style.fontWeight = &amp;#039;normal&amp;#039;;&lt;br /&gt;
			Button.style.textAlign = &amp;#039;right&amp;#039;;&lt;br /&gt;
			Button.style.width = &amp;#039;6em&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
			ButtonLink.setAttribute( &amp;#039;id&amp;#039;, &amp;#039;collapseButton&amp;#039; + tableIndex );&lt;br /&gt;
			ButtonLink.setAttribute( &amp;#039;href&amp;#039;, &amp;#039;javascript:collapseTable(&amp;#039; + tableIndex + &amp;#039;);&amp;#039; );&lt;br /&gt;
			ButtonLink.appendChild( ButtonText );&lt;br /&gt;
&lt;br /&gt;
			Button.appendChild( document.createTextNode( &amp;#039;[&amp;#039; ) );&lt;br /&gt;
			Button.appendChild( ButtonLink );&lt;br /&gt;
			Button.appendChild( document.createTextNode( &amp;#039;]&amp;#039; ) );&lt;br /&gt;
&lt;br /&gt;
			var Header = Tables[i].getElementsByTagName( &amp;#039;tr&amp;#039; )[0].getElementsByTagName( &amp;#039;th&amp;#039; )[0];&lt;br /&gt;
			/* only add button and increment count if there is a header row to work with */&lt;br /&gt;
			if (Header) {&lt;br /&gt;
				Header.insertBefore( Button, Header.childNodes[0] );&lt;br /&gt;
				tableIndex++;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	for ( i = 0; i &amp;lt; tableIndex; i++ ) {&lt;br /&gt;
		if ( hasClass( NavigationBoxes[i], &amp;#039;collapsed&amp;#039; ) || ( tableIndex &amp;gt;= autoCollapse &amp;amp;&amp;amp; hasClass( NavigationBoxes[i], &amp;#039;autocollapse&amp;#039; ) ) ) {&lt;br /&gt;
			collapseTable( i );&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$( createCollapseButtons );&lt;/div&gt;</summary>
		<author><name>Guy</name></author>
		
	</entry>
</feed>