<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.freecapitalists.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AJQuery-makeCollapsible.js</id>
	<title>MediaWiki:JQuery-makeCollapsible.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.freecapitalists.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AJQuery-makeCollapsible.js"/>
	<link rel="alternate" type="text/html" href="https://wiki.freecapitalists.org/index.php?title=MediaWiki:JQuery-makeCollapsible.js&amp;action=history"/>
	<updated>2026-08-15T10:39:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.freecapitalists.org/index.php?title=MediaWiki:JQuery-makeCollapsible.js&amp;diff=20570&amp;oldid=prev</id>
		<title>John James: Created page with &quot;/**  * jQuery makeCollapsible  *  * This will enable collapsible-functionality on all passed elements.  * Will prevent binding twice to the same element.  * Initial state is e...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.freecapitalists.org/index.php?title=MediaWiki:JQuery-makeCollapsible.js&amp;diff=20570&amp;oldid=prev"/>
		<updated>2012-09-08T23:49:57Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;/**  * jQuery makeCollapsible  *  * This will enable collapsible-functionality on all passed elements.  * Will prevent binding twice to the same element.  * Initial state is e...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**&lt;br /&gt;
 * jQuery makeCollapsible&lt;br /&gt;
 *&lt;br /&gt;
 * This will enable collapsible-functionality on all passed elements.&lt;br /&gt;
 * Will prevent binding twice to the same element.&lt;br /&gt;
 * Initial state is expanded by default, this can be overriden by adding class&lt;br /&gt;
 * &amp;quot;mw-collapsed&amp;quot; to the &amp;quot;mw-collapsible&amp;quot; element.&lt;br /&gt;
 * Elements made collapsible have class &amp;quot;mw-made-collapsible&amp;quot;.&lt;br /&gt;
 * Except for tables and lists, the inner content is wrapped in &amp;quot;mw-collapsible-content&amp;quot;.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Krinkle &amp;lt;krinklemail@gmail.com&amp;gt;&lt;br /&gt;
 *&lt;br /&gt;
 * Dual license:&lt;br /&gt;
 * @license CC-BY 3.0 &amp;lt;http://creativecommons.org/licenses/by/3.0&amp;gt;&lt;br /&gt;
 * @license GPL2 &amp;lt;http://www.gnu.org/licenses/old-licenses/gpl-2.0.html&amp;gt;&lt;br /&gt;
 */&lt;br /&gt;
( function ( $, mw ) {&lt;br /&gt;
&lt;br /&gt;
$.fn.makeCollapsible = function () {&lt;br /&gt;
&lt;br /&gt;
	return this.each(function () {&lt;br /&gt;
		var lpx = &amp;#039;jquery.makeCollapsible&amp;gt; &amp;#039;;&lt;br /&gt;
&lt;br /&gt;
		// Define reused variables and functions&lt;br /&gt;
		var $toggle,&lt;br /&gt;
			$that = $(this).addClass( &amp;#039;mw-collapsible&amp;#039; ), // case: $( &amp;#039;#myAJAXelement&amp;#039; ).makeCollapsible()&lt;br /&gt;
			that = this,&lt;br /&gt;
			collapsetext = $(this).attr( &amp;#039;data-collapsetext&amp;#039; ),&lt;br /&gt;
			expandtext = $(this).attr( &amp;#039;data-expandtext&amp;#039; ),&lt;br /&gt;
			toggleElement = function ( $collapsible, action, $defaultToggle, instantHide ) {&lt;br /&gt;
				var $collapsibleContent, $containers;&lt;br /&gt;
&lt;br /&gt;
				// Validate parameters&lt;br /&gt;
				if ( !$collapsible.jquery ) { // $collapsible must be an instance of jQuery&lt;br /&gt;
					return;&lt;br /&gt;
				}&lt;br /&gt;
				if ( action !== &amp;#039;expand&amp;#039; &amp;amp;&amp;amp; action !== &amp;#039;collapse&amp;#039; ) {&lt;br /&gt;
					// action must be string with &amp;#039;expand&amp;#039; or &amp;#039;collapse&amp;#039;&lt;br /&gt;
					return;&lt;br /&gt;
				}&lt;br /&gt;
				if ( $defaultToggle === undefined ) {&lt;br /&gt;
					$defaultToggle = null;&lt;br /&gt;
				}&lt;br /&gt;
				if ( $defaultToggle !== null &amp;amp;&amp;amp; !($defaultToggle instanceof $) ) {&lt;br /&gt;
					// is optional (may be undefined), but if defined it must be an instance of jQuery.&lt;br /&gt;
					// If it&amp;#039;s not, abort right away.&lt;br /&gt;
					// After this $defaultToggle is either null or a valid jQuery instance.&lt;br /&gt;
					return;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				if ( action === &amp;#039;collapse&amp;#039; ) {&lt;br /&gt;
&lt;br /&gt;
					// Collapse the element&lt;br /&gt;
					if ( $collapsible.is( &amp;#039;table&amp;#039; ) ) {&lt;br /&gt;
						// Hide all table rows of this table&lt;br /&gt;
						// Slide doens&amp;#039;t work with tables, but fade does as of jQuery 1.1.3&lt;br /&gt;
						// http://stackoverflow.com/questions/467336#920480&lt;br /&gt;
						$containers = $collapsible.find( &amp;#039;&amp;gt;tbody&amp;gt;tr&amp;#039; );&lt;br /&gt;
						if ( $defaultToggle ) {&lt;br /&gt;
							// Exclude tablerow containing togglelink&lt;br /&gt;
							$containers.not( $defaultToggle.closest( &amp;#039;tr&amp;#039; ) ).stop(true, true).fadeOut();&lt;br /&gt;
						} else {&lt;br /&gt;
							if ( instantHide ) {&lt;br /&gt;
								$containers.hide();&lt;br /&gt;
							} else {&lt;br /&gt;
								$containers.stop( true, true ).fadeOut();&lt;br /&gt;
							}&lt;br /&gt;
						}&lt;br /&gt;
&lt;br /&gt;
					} else if ( $collapsible.is( &amp;#039;ul&amp;#039; ) || $collapsible.is( &amp;#039;ol&amp;#039; ) ) {&lt;br /&gt;
						$containers = $collapsible.find( &amp;#039;&amp;gt; li&amp;#039; );&lt;br /&gt;
						if ( $defaultToggle ) {&lt;br /&gt;
							// Exclude list-item containing togglelink&lt;br /&gt;
							$containers.not( $defaultToggle.parent() ).stop( true, true ).slideUp();&lt;br /&gt;
						} else {&lt;br /&gt;
							if ( instantHide ) {&lt;br /&gt;
								$containers.hide();&lt;br /&gt;
							} else {&lt;br /&gt;
								$containers.stop( true, true ).slideUp();&lt;br /&gt;
							}&lt;br /&gt;
						}&lt;br /&gt;
&lt;br /&gt;
					} else { // &amp;lt;div&amp;gt;, &amp;lt;p&amp;gt; etc.&lt;br /&gt;
						$collapsibleContent = $collapsible.find( &amp;#039;&amp;gt; .mw-collapsible-content&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
						// If a collapsible-content is defined, collapse it&lt;br /&gt;
						if ( $collapsibleContent.length ) {&lt;br /&gt;
							if ( instantHide ) {&lt;br /&gt;
								$collapsibleContent.hide();&lt;br /&gt;
							} else {&lt;br /&gt;
								$collapsibleContent.slideUp();&lt;br /&gt;
							}&lt;br /&gt;
&lt;br /&gt;
						// Otherwise assume this is a customcollapse with a remote toggle&lt;br /&gt;
						// .. and there is no collapsible-content because the entire element should be toggled&lt;br /&gt;
						} else {&lt;br /&gt;
							if ( $collapsible.is( &amp;#039;tr&amp;#039; ) || $collapsible.is( &amp;#039;td&amp;#039; ) || $collapsible.is( &amp;#039;th&amp;#039; ) ) {&lt;br /&gt;
								$collapsible.fadeOut();&lt;br /&gt;
							} else {&lt;br /&gt;
								$collapsible.slideUp();&lt;br /&gt;
							}&lt;br /&gt;
						}&lt;br /&gt;
					}&lt;br /&gt;
&lt;br /&gt;
				} else {&lt;br /&gt;
&lt;br /&gt;
					// Expand the element&lt;br /&gt;
					if ( $collapsible.is( &amp;#039;table&amp;#039; ) ) {&lt;br /&gt;
						$containers = $collapsible.find( &amp;#039;&amp;gt;tbody&amp;gt;tr&amp;#039; );&lt;br /&gt;
						if ( $defaultToggle ) {&lt;br /&gt;
							// Exclude tablerow containing togglelink&lt;br /&gt;
							$containers.not( $defaultToggle.parent().parent() ).stop(true, true).fadeIn();&lt;br /&gt;
						} else {&lt;br /&gt;
							$containers.stop(true, true).fadeIn();&lt;br /&gt;
						}&lt;br /&gt;
&lt;br /&gt;
					} else if ( $collapsible.is( &amp;#039;ul&amp;#039; ) || $collapsible.is( &amp;#039;ol&amp;#039; ) ) {&lt;br /&gt;
						$containers = $collapsible.find( &amp;#039;&amp;gt; li&amp;#039; );&lt;br /&gt;
						if ( $defaultToggle ) {&lt;br /&gt;
							// Exclude list-item containing togglelink&lt;br /&gt;
							$containers.not( $defaultToggle.parent() ).stop( true, true ).slideDown();&lt;br /&gt;
						} else {&lt;br /&gt;
							$containers.stop( true, true ).slideDown();&lt;br /&gt;
						}&lt;br /&gt;
&lt;br /&gt;
					} else { // &amp;lt;div&amp;gt;, &amp;lt;p&amp;gt; etc.&lt;br /&gt;
						$collapsibleContent = $collapsible.find( &amp;#039;&amp;gt; .mw-collapsible-content&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
						// If a collapsible-content is defined, collapse it&lt;br /&gt;
						if ( $collapsibleContent.length ) {&lt;br /&gt;
							$collapsibleContent.slideDown();&lt;br /&gt;
&lt;br /&gt;
						// Otherwise assume this is a customcollapse with a remote toggle&lt;br /&gt;
						// .. and there is no collapsible-content because the entire element should be toggled&lt;br /&gt;
						} else {&lt;br /&gt;
							if ( $collapsible.is( &amp;#039;tr&amp;#039; ) || $collapsible.is( &amp;#039;td&amp;#039; ) || $collapsible.is( &amp;#039;th&amp;#039; ) ) {&lt;br /&gt;
								$collapsible.fadeIn();&lt;br /&gt;
							} else {&lt;br /&gt;
								$collapsible.slideDown();&lt;br /&gt;
							}&lt;br /&gt;
						}&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			},&lt;br /&gt;
			// Toggles collapsible and togglelink class and updates text label&lt;br /&gt;
			toggleLinkDefault = function ( that, e ) {&lt;br /&gt;
				var $that = $(that),&lt;br /&gt;
					$collapsible = $that.closest( &amp;#039;.mw-collapsible.mw-made-collapsible&amp;#039; ).toggleClass( &amp;#039;mw-collapsed&amp;#039; );&lt;br /&gt;
				e.preventDefault();&lt;br /&gt;
				e.stopPropagation();&lt;br /&gt;
&lt;br /&gt;
				// It&amp;#039;s expanded right now&lt;br /&gt;
				if ( !$that.hasClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; ) ) {&lt;br /&gt;
					// Change link to &amp;quot;Show&amp;quot;&lt;br /&gt;
					$that.removeClass( &amp;#039;mw-collapsible-toggle-expanded&amp;#039; ).addClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; );&lt;br /&gt;
					if ( $that.find( &amp;#039;&amp;gt; a&amp;#039; ).length ) {&lt;br /&gt;
						$that.find( &amp;#039;&amp;gt; a&amp;#039; ).text( expandtext );&lt;br /&gt;
					} else {&lt;br /&gt;
						$that.text( expandtext );&lt;br /&gt;
					}&lt;br /&gt;
					// Collapse element&lt;br /&gt;
					toggleElement( $collapsible, &amp;#039;collapse&amp;#039;, $that );&lt;br /&gt;
&lt;br /&gt;
				// It&amp;#039;s collapsed right now&lt;br /&gt;
				} else {&lt;br /&gt;
					// Change link to &amp;quot;Hide&amp;quot;&lt;br /&gt;
					$that.removeClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; ).addClass( &amp;#039;mw-collapsible-toggle-expanded&amp;#039; );&lt;br /&gt;
					if ( $that.find( &amp;#039;&amp;gt; a&amp;#039; ).length ) {&lt;br /&gt;
						$that.find( &amp;#039;&amp;gt; a&amp;#039; ).text( collapsetext );&lt;br /&gt;
					} else {&lt;br /&gt;
						$that.text( collapsetext );&lt;br /&gt;
					}&lt;br /&gt;
					// Expand element&lt;br /&gt;
					toggleElement( $collapsible, &amp;#039;expand&amp;#039;, $that );&lt;br /&gt;
				}&lt;br /&gt;
				return;&lt;br /&gt;
			},&lt;br /&gt;
			// Toggles collapsible and togglelink class&lt;br /&gt;
			toggleLinkPremade = function ( $that, e ) {&lt;br /&gt;
				var $collapsible = $that.eq(0).closest( &amp;#039;.mw-collapsible.mw-made-collapsible&amp;#039; ).toggleClass( &amp;#039;mw-collapsed&amp;#039; );&lt;br /&gt;
				if ( $(e.target).is( &amp;#039;a&amp;#039; ) ) {&lt;br /&gt;
					return true;&lt;br /&gt;
				}&lt;br /&gt;
				e.preventDefault();&lt;br /&gt;
				e.stopPropagation();&lt;br /&gt;
&lt;br /&gt;
				// It&amp;#039;s expanded right now&lt;br /&gt;
				if ( !$that.hasClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; ) ) {&lt;br /&gt;
					// Change toggle to collapsed&lt;br /&gt;
					$that.removeClass( &amp;#039;mw-collapsible-toggle-expanded&amp;#039; ).addClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; );&lt;br /&gt;
					// Collapse element&lt;br /&gt;
					toggleElement( $collapsible, &amp;#039;collapse&amp;#039;, $that );&lt;br /&gt;
&lt;br /&gt;
				// It&amp;#039;s collapsed right now&lt;br /&gt;
				} else {&lt;br /&gt;
					// Change toggle to expanded&lt;br /&gt;
					$that.removeClass( &amp;#039;mw-collapsible-toggle-collapsed&amp;#039; ).addClass( &amp;#039;mw-collapsible-toggle-expanded&amp;#039; );&lt;br /&gt;
					// Expand element&lt;br /&gt;
					toggleElement( $collapsible, &amp;#039;expand&amp;#039;, $that );&lt;br /&gt;
				}&lt;br /&gt;
				return;&lt;br /&gt;
			},&lt;br /&gt;
			// Toggles customcollapsible&lt;br /&gt;
			toggleLinkCustom = function ( $that, e, $collapsible ) {&lt;br /&gt;
				// For the initial state call of customtogglers there is no event passed&lt;br /&gt;
				if (e) {&lt;br /&gt;
					e.preventDefault();&lt;br /&gt;
					e.stopPropagation();&lt;br /&gt;
				}&lt;br /&gt;
				// Get current state and toggle to the opposite&lt;br /&gt;
				var action = $collapsible.hasClass( &amp;#039;mw-collapsed&amp;#039; ) ? &amp;#039;expand&amp;#039; : &amp;#039;collapse&amp;#039;;&lt;br /&gt;
				$collapsible.toggleClass( &amp;#039;mw-collapsed&amp;#039; );&lt;br /&gt;
				toggleElement( $collapsible, action, $that );&lt;br /&gt;
&lt;br /&gt;
			};&lt;br /&gt;
&lt;br /&gt;
		// Use custom text or default ?&lt;br /&gt;
		if ( !collapsetext ) {&lt;br /&gt;
			collapsetext = mw.msg( &amp;#039;collapsible-collapse&amp;#039; );&lt;br /&gt;
		}&lt;br /&gt;
		if ( !expandtext ) {&lt;br /&gt;
			expandtext = mw.msg( &amp;#039;collapsible-expand&amp;#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Create toggle link with a space around the brackets (&amp;amp;nbsp;[text]&amp;amp;nbsp;)&lt;br /&gt;
		var $toggleLink =&lt;br /&gt;
			$( &amp;#039;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;#039; )&lt;br /&gt;
				.text( collapsetext )&lt;br /&gt;
				.wrap( &amp;#039;&amp;lt;span class=&amp;quot;mw-collapsible-toggle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;#039; )&lt;br /&gt;
				.parent()&lt;br /&gt;
				.prepend( &amp;#039;&amp;amp;nbsp;[&amp;#039; )&lt;br /&gt;
				.append( &amp;#039;]&amp;amp;nbsp;&amp;#039; )&lt;br /&gt;
				.bind( &amp;#039;click.mw-collapse&amp;#039;, function (e) {&lt;br /&gt;
					toggleLinkDefault( this, e );&lt;br /&gt;
				} );&lt;br /&gt;
&lt;br /&gt;
		// Return if it has been enabled already.&lt;br /&gt;
		if ( $that.hasClass( &amp;#039;mw-made-collapsible&amp;#039; ) ) {&lt;br /&gt;
			return;&lt;br /&gt;
		} else {&lt;br /&gt;
			$that.addClass( &amp;#039;mw-made-collapsible&amp;#039; );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Check if this element has a custom position for the toggle link&lt;br /&gt;
		// (ie. outside the container or deeper inside the tree)&lt;br /&gt;
		// Then: Locate the custom toggle link(s) and bind them&lt;br /&gt;
		if ( ( $that.attr( &amp;#039;id&amp;#039; ) || &amp;#039;&amp;#039; ).indexOf( &amp;#039;mw-customcollapsible-&amp;#039; ) === 0 ) {&lt;br /&gt;
&lt;br /&gt;
			var thatId = $that.attr( &amp;#039;id&amp;#039; ),&lt;br /&gt;
				$customTogglers = $( &amp;#039;.&amp;#039; + thatId.replace( &amp;#039;mw-customcollapsible&amp;#039;, &amp;#039;mw-customtoggle&amp;#039; ) );&lt;br /&gt;
			mw.log( lpx + &amp;#039;Found custom collapsible: #&amp;#039; + thatId );&lt;br /&gt;
&lt;br /&gt;
			// Double check that there is actually a customtoggle link&lt;br /&gt;
			if ( $customTogglers.length ) {&lt;br /&gt;
				$customTogglers.bind( &amp;#039;click.mw-collapse&amp;#039;, function ( e ) {&lt;br /&gt;
					toggleLinkCustom( $(this), e, $that );&lt;br /&gt;
				} );&lt;br /&gt;
			} else {&lt;br /&gt;
				mw.log( lpx + &amp;#039;#&amp;#039; + thatId + &amp;#039;: Missing toggler!&amp;#039; );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Initial state&lt;br /&gt;
			if ( $that.hasClass( &amp;#039;mw-collapsed&amp;#039; ) ) {&lt;br /&gt;
				$that.removeClass( &amp;#039;mw-collapsed&amp;#039; );&lt;br /&gt;
				toggleLinkCustom( $customTogglers, null, $that );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
		// If this is not a custom case, do the default:&lt;br /&gt;
		// Wrap the contents add the toggle link&lt;br /&gt;
		} else {&lt;br /&gt;
&lt;br /&gt;
			// Elements are treated differently&lt;br /&gt;
			if ( $that.is( &amp;#039;table&amp;#039; ) ) {&lt;br /&gt;
				// The toggle-link will be in one the the cells (td or th) of the first row&lt;br /&gt;
				var $firstRowCells = $that.find( &amp;#039;tr:first th, tr:first td&amp;#039; );&lt;br /&gt;
				$toggle = $firstRowCells.find( &amp;#039;&amp;gt; .mw-collapsible-toggle&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
				// If theres no toggle link, add it to the last cell&lt;br /&gt;
				if ( !$toggle.length ) {&lt;br /&gt;
					$firstRowCells.eq(-1).prepend( $toggleLink );&lt;br /&gt;
				} else {&lt;br /&gt;
					$toggleLink = $toggle.unbind( &amp;#039;click.mw-collapse&amp;#039; ).bind( &amp;#039;click.mw-collapse&amp;#039;, function ( e ) {&lt;br /&gt;
						toggleLinkPremade( $toggle, e );&lt;br /&gt;
					} );&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
			} else if ( $that.is( &amp;#039;ul&amp;#039; ) || $that.is( &amp;#039;ol&amp;#039; ) ) {&lt;br /&gt;
				// The toggle-link will be in the first list-item&lt;br /&gt;
				var $firstItem = $that.find( &amp;#039;li:first&amp;#039; );&lt;br /&gt;
				$toggle = $firstItem.find( &amp;#039;&amp;gt; .mw-collapsible-toggle&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
				// If theres no toggle link, add it&lt;br /&gt;
				if ( !$toggle.length ) {&lt;br /&gt;
					// Make sure the numeral order doesn&amp;#039;t get messed up, force the first (soon to be second) item&lt;br /&gt;
					// to be &amp;quot;1&amp;quot;. Except if the value-attribute is already used.&lt;br /&gt;
					// If no value was set WebKit returns &amp;quot;&amp;quot;, Mozilla returns &amp;#039;-1&amp;#039;, others return null or undefined.&lt;br /&gt;
					var firstval = $firstItem.attr( &amp;#039;value&amp;#039; );&lt;br /&gt;
					if ( firstval === undefined || !firstval || firstval === &amp;#039;-1&amp;#039; || firstval === -1 ) {&lt;br /&gt;
						$firstItem.attr( &amp;#039;value&amp;#039;, &amp;#039;1&amp;#039; );&lt;br /&gt;
					}&lt;br /&gt;
					$that.prepend( $toggleLink.wrap( &amp;#039;&amp;lt;li class=&amp;quot;mw-collapsible-toggle-li&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&amp;#039; ).parent() );&lt;br /&gt;
				} else {&lt;br /&gt;
					$toggleLink = $toggle.unbind( &amp;#039;click.mw-collapse&amp;#039; ).bind( &amp;#039;click.mw-collapse&amp;#039;, function ( e ) {&lt;br /&gt;
						toggleLinkPremade( $toggle, e );&lt;br /&gt;
					} );&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
			} else { // &amp;lt;div&amp;gt;, &amp;lt;p&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
				// The toggle-link will be the first child of the element&lt;br /&gt;
				$toggle = $that.find( &amp;#039;&amp;gt; .mw-collapsible-toggle&amp;#039; );&lt;br /&gt;
&lt;br /&gt;
				// If a direct child .content-wrapper does not exists, create it&lt;br /&gt;
				if ( !$that.find( &amp;#039;&amp;gt; .mw-collapsible-content&amp;#039; ).length ) {&lt;br /&gt;
					$that.wrapInner( &amp;#039;&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039; );&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				// If theres no toggle link, add it&lt;br /&gt;
				if ( !$toggle.length ) {&lt;br /&gt;
					$that.prepend( $toggleLink );&lt;br /&gt;
				} else {&lt;br /&gt;
					$toggleLink = $toggle.unbind( &amp;#039;click.mw-collapse&amp;#039; ).bind( &amp;#039;click.mw-collapse&amp;#039;, function ( e ) {&lt;br /&gt;
						toggleLinkPremade( $toggle, e );&lt;br /&gt;
					} );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Initial state (only for those that are not custom)&lt;br /&gt;
		if ( $that.hasClass( &amp;#039;mw-collapsed&amp;#039; ) &amp;amp;&amp;amp; ( $that.attr( &amp;#039;id&amp;#039; ) || &amp;#039;&amp;#039;).indexOf( &amp;#039;mw-customcollapsible-&amp;#039; ) !== 0 ) {&lt;br /&gt;
			$that.removeClass( &amp;#039;mw-collapsed&amp;#039; );&lt;br /&gt;
			// The collapsible element could have multiple togglers&lt;br /&gt;
			// To toggle the initial state only click one of them (ie. the first one, eq(0) )&lt;br /&gt;
			// Else it would go like: hide,show,hide,show for each toggle link.&lt;br /&gt;
			toggleElement( $that, &amp;#039;collapse&amp;#039;, $toggleLink.eq(0), /* instantHide = */ true );&lt;br /&gt;
			$toggleLink.eq(0).click();&lt;br /&gt;
		}&lt;br /&gt;
	} );&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
}( jQuery, mediaWiki ) );&lt;/div&gt;</summary>
		<author><name>John James</name></author>
	</entry>
</feed>