<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.sho.wiki/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://www.sho.wiki/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3ACommon.js"/>
		<link rel="alternate" type="text/html" href="http://www.sho.wiki/index.php?title=MediaWiki:Common.js&amp;action=history"/>
		<updated>2026-04-19T20:36:49Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://www.sho.wiki/index.php?title=MediaWiki:Common.js&amp;diff=1182&amp;oldid=prev</id>
		<title>S.H.O.: Created page with &quot;/* Any JavaScript here will be loaded for all users on every page load. */  /**  * jQuery makeCollapsible  *  * Dual licensed:  * - CC BY 3.0 &lt;http://creativecommons.org/licen...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.sho.wiki/index.php?title=MediaWiki:Common.js&amp;diff=1182&amp;oldid=prev"/>
				<updated>2016-09-24T18:33:29Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Any JavaScript here will be loaded for all users on every page load.: &lt;/span&gt;  /**  * jQuery makeCollapsible  *  * Dual licensed:  * - CC BY 3.0 &amp;lt;http://creativecommons.org/licen...&amp;quot;&lt;/span&gt;&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;
/**&lt;br /&gt;
 * jQuery makeCollapsible&lt;br /&gt;
 *&lt;br /&gt;
 * Dual licensed:&lt;br /&gt;
 * - CC BY 3.0 &amp;lt;http://creativecommons.org/licenses/by/3.0&amp;gt;&lt;br /&gt;
 * - GPL2 &amp;lt;http://www.gnu.org/licenses/old-licenses/gpl-2.0.html&amp;gt;&lt;br /&gt;
 *&lt;br /&gt;
 * @class jQuery.plugin.makeCollapsible&lt;br /&gt;
 */&lt;br /&gt;
( function ( $, mw ) {&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Handler for a click on a collapsible toggler.&lt;br /&gt;
	 *&lt;br /&gt;
	 * @private&lt;br /&gt;
	 * @param {jQuery} $collapsible&lt;br /&gt;
	 * @param {string} action The action this function will take ('expand' or 'collapse').&lt;br /&gt;
	 * @param {jQuery|null} [$defaultToggle]&lt;br /&gt;
	 * @param {Object|undefined} [options]&lt;br /&gt;
	 */&lt;br /&gt;
	function toggleElement( $collapsible, action, $defaultToggle, options ) {&lt;br /&gt;
		var $collapsibleContent, $containers, hookCallback;&lt;br /&gt;
		options = options || {};&lt;br /&gt;
&lt;br /&gt;
		// Validate parameters&lt;br /&gt;
&lt;br /&gt;
		// $collapsible must be an instance of jQuery&lt;br /&gt;
		if ( !$collapsible.jquery ) {&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		if ( action !== 'expand' &amp;amp;&amp;amp; action !== 'collapse' ) {&lt;br /&gt;
			// action must be string with 'expand' or 'collapse'&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.jquery ) {&lt;br /&gt;
			// is optional (may be undefined), but if defined it must be an instance of jQuery.&lt;br /&gt;
			// If it'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;
		// Trigger a custom event to allow callers to hook to the collapsing/expanding,&lt;br /&gt;
		// allowing the module to be testable, and making it possible to&lt;br /&gt;
		// e.g. implement persistence via cookies&lt;br /&gt;
		$collapsible.trigger( action === 'expand' ? 'beforeExpand.mw-collapsible' : 'beforeCollapse.mw-collapsible' );&lt;br /&gt;
		hookCallback = function () {&lt;br /&gt;
			$collapsible.trigger( action === 'expand' ? 'afterExpand.mw-collapsible' : 'afterCollapse.mw-collapsible' );&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		// Handle different kinds of elements&lt;br /&gt;
&lt;br /&gt;
		if ( !options.plainMode &amp;amp;&amp;amp; $collapsible.is( 'table' ) ) {&lt;br /&gt;
			// Tables&lt;br /&gt;
			// If there is a caption, hide all rows; otherwise, only hide body rows&lt;br /&gt;
			if ( $collapsible.find( '&amp;gt; caption' ).length ) {&lt;br /&gt;
				$containers = $collapsible.find( '&amp;gt; * &amp;gt; tr' );&lt;br /&gt;
			} else {&lt;br /&gt;
				$containers = $collapsible.find( '&amp;gt; tbody &amp;gt; tr' );&lt;br /&gt;
			}&lt;br /&gt;
			if ( $defaultToggle ) {&lt;br /&gt;
				// Exclude table row containing togglelink&lt;br /&gt;
				$containers = $containers.not( $defaultToggle.closest( 'tr' ) );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if ( action === 'collapse' ) {&lt;br /&gt;
				// Hide all table rows of this table&lt;br /&gt;
				// Slide doesn'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;
				if ( options.instantHide ) {&lt;br /&gt;
					$containers.hide();&lt;br /&gt;
					hookCallback();&lt;br /&gt;
				} else {&lt;br /&gt;
					$containers.stop( true, true ).fadeOut().promise().done( hookCallback );&lt;br /&gt;
				}&lt;br /&gt;
			} else {&lt;br /&gt;
				$containers.stop( true, true ).fadeIn().promise().done( hookCallback );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
		} else if ( !options.plainMode &amp;amp;&amp;amp; ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) ) {&lt;br /&gt;
			// Lists&lt;br /&gt;
			$containers = $collapsible.find( '&amp;gt; li' );&lt;br /&gt;
			if ( $defaultToggle ) {&lt;br /&gt;
				// Exclude list-item containing togglelink&lt;br /&gt;
				$containers = $containers.not( $defaultToggle.parent() );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if ( action === 'collapse' ) {&lt;br /&gt;
				if ( options.instantHide ) {&lt;br /&gt;
					$containers.hide();&lt;br /&gt;
					hookCallback();&lt;br /&gt;
				} else {&lt;br /&gt;
					$containers.stop( true, true ).slideUp().promise().done( hookCallback );&lt;br /&gt;
				}&lt;br /&gt;
			} else {&lt;br /&gt;
				$containers.stop( true, true ).slideDown().promise().done( hookCallback );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
		} else {&lt;br /&gt;
			// Everything else: &amp;lt;div&amp;gt;, &amp;lt;p&amp;gt; etc.&lt;br /&gt;
			$collapsibleContent = $collapsible.find( '&amp;gt; .mw-collapsible-content' );&lt;br /&gt;
&lt;br /&gt;
			// If a collapsible-content is defined, act on it&lt;br /&gt;
			if ( !options.plainMode &amp;amp;&amp;amp; $collapsibleContent.length ) {&lt;br /&gt;
				if ( action === 'collapse' ) {&lt;br /&gt;
					if ( options.instantHide ) {&lt;br /&gt;
						$collapsibleContent.hide();&lt;br /&gt;
						hookCallback();&lt;br /&gt;
					} else {&lt;br /&gt;
						$collapsibleContent.slideUp().promise().done( hookCallback );&lt;br /&gt;
					}&lt;br /&gt;
				} else {&lt;br /&gt;
					$collapsibleContent.slideDown().promise().done( hookCallback );&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 ( action === 'collapse' ) {&lt;br /&gt;
					if ( options.instantHide ) {&lt;br /&gt;
						$collapsible.hide();&lt;br /&gt;
						hookCallback();&lt;br /&gt;
					} else {&lt;br /&gt;
						if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {&lt;br /&gt;
							$collapsible.fadeOut().promise().done( hookCallback );&lt;br /&gt;
						} else {&lt;br /&gt;
							$collapsible.slideUp().promise().done( hookCallback );&lt;br /&gt;
						}&lt;br /&gt;
					}&lt;br /&gt;
				} else {&lt;br /&gt;
					if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {&lt;br /&gt;
						$collapsible.fadeIn().promise().done( hookCallback );&lt;br /&gt;
					} else {&lt;br /&gt;
						$collapsible.slideDown().promise().done( hookCallback );&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Handle clicking/keypressing on the collapsible element toggle and other&lt;br /&gt;
	 * situations where a collapsible element is toggled (e.g. the initial&lt;br /&gt;
	 * toggle for collapsed ones).&lt;br /&gt;
	 *&lt;br /&gt;
	 * @private&lt;br /&gt;
	 * @param {jQuery} $toggle the clickable toggle itself&lt;br /&gt;
	 * @param {jQuery} $collapsible the collapsible element&lt;br /&gt;
	 * @param {jQuery.Event|null} e either the event or null if unavailable&lt;br /&gt;
	 * @param {Object|undefined} options&lt;br /&gt;
	 */&lt;br /&gt;
	function togglingHandler( $toggle, $collapsible, e, options ) {&lt;br /&gt;
		var wasCollapsed, $textContainer, collapseText, expandText;&lt;br /&gt;
		options = options || {};&lt;br /&gt;
&lt;br /&gt;
		if ( e ) {&lt;br /&gt;
			if (&lt;br /&gt;
				e.type === 'click' &amp;amp;&amp;amp;&lt;br /&gt;
				options.linksPassthru &amp;amp;&amp;amp;&lt;br /&gt;
				$.nodeName( e.target, 'a' ) &amp;amp;&amp;amp;&lt;br /&gt;
				$( e.target ).attr( 'href' ) &amp;amp;&amp;amp;&lt;br /&gt;
				$( e.target ).attr( 'href' ) !== '#'&lt;br /&gt;
			) {&lt;br /&gt;
				// Don't fire if a link with href !== '#' was clicked, if requested  (for premade togglers by default)&lt;br /&gt;
				return;&lt;br /&gt;
			} else if ( e.type === 'keypress' &amp;amp;&amp;amp; e.which !== 13 &amp;amp;&amp;amp; e.which !== 32 ) {&lt;br /&gt;
				// Only handle keypresses on the &amp;quot;Enter&amp;quot; or &amp;quot;Space&amp;quot; keys&lt;br /&gt;
				return;&lt;br /&gt;
			} else {&lt;br /&gt;
				e.preventDefault();&lt;br /&gt;
				e.stopPropagation();&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// This allows the element to be hidden on initial toggle without fiddling with the class&lt;br /&gt;
		if ( options.wasCollapsed !== undefined ) {&lt;br /&gt;
			wasCollapsed = options.wasCollapsed;&lt;br /&gt;
		} else {&lt;br /&gt;
			wasCollapsed = $collapsible.hasClass( 'mw-collapsed' );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Toggle the state of the collapsible element (that is, expand or collapse)&lt;br /&gt;
		$collapsible.toggleClass( 'mw-collapsed', !wasCollapsed );&lt;br /&gt;
&lt;br /&gt;
		// Toggle the mw-collapsible-toggle classes, if requested (for default and premade togglers by default)&lt;br /&gt;
		if ( options.toggleClasses ) {&lt;br /&gt;
			$toggle&lt;br /&gt;
				.toggleClass( 'mw-collapsible-toggle-collapsed', !wasCollapsed )&lt;br /&gt;
				.toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Toggle the text (&amp;quot;Show&amp;quot;/&amp;quot;Hide&amp;quot;), if requested (for default togglers by default)&lt;br /&gt;
		if ( options.toggleText ) {&lt;br /&gt;
			collapseText = options.toggleText.collapseText;&lt;br /&gt;
			expandText = options.toggleText.expandText;&lt;br /&gt;
&lt;br /&gt;
			$textContainer = $toggle.find( '&amp;gt; a' );&lt;br /&gt;
			if ( !$textContainer.length ) {&lt;br /&gt;
				$textContainer = $toggle;&lt;br /&gt;
			}&lt;br /&gt;
			$textContainer.text( wasCollapsed ? collapseText : expandText );&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// And finally toggle the element state itself&lt;br /&gt;
		toggleElement( $collapsible, wasCollapsed ? 'expand' : 'collapse', $toggle, options );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * Enable collapsible-functionality on all elements in the collection.&lt;br /&gt;
	 *&lt;br /&gt;
	 * - Will prevent binding twice to the same element.&lt;br /&gt;
	 * - Initial state is expanded by default, this can be overridden 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 jQuery data &amp;quot;mw-made-collapsible&amp;quot; set to true.&lt;br /&gt;
	 * - The inner content is wrapped in a &amp;quot;div.mw-collapsible-content&amp;quot; (except for tables and lists).&lt;br /&gt;
	 *&lt;br /&gt;
	 * @param {Object} [options]&lt;br /&gt;
	 * @param {string} [options.collapseText] Text used for the toggler, when clicking it would&lt;br /&gt;
	 *   collapse the element. Default: the 'data-collapsetext' attribute of the&lt;br /&gt;
	 *   collapsible element or the content of 'collapsible-collapse' message.&lt;br /&gt;
	 * @param {string} [options.expandText] Text used for the toggler, when clicking it would&lt;br /&gt;
	 *   expand the element. Default: the 'data-expandtext' attribute of the&lt;br /&gt;
	 *   collapsible element or the content of 'collapsible-expand' message.&lt;br /&gt;
	 * @param {boolean} [options.collapsed] Whether to collapse immediately. By default&lt;br /&gt;
	 *   collapse only if the elements has the 'mw-collapsible' class.&lt;br /&gt;
	 * @param {jQuery} [options.$customTogglers] Elements to be used as togglers&lt;br /&gt;
	 *   for this collapsible element. By default, if the collapsible element&lt;br /&gt;
	 *   has an id attribute like 'mw-customcollapsible-XXX', elements with a&lt;br /&gt;
	 *   *class* of 'mw-customtoggle-XXX' are made togglers for it.&lt;br /&gt;
	 * @param {boolean} [options.plainMode=false] Whether to use a &amp;quot;plain mode&amp;quot; when making the&lt;br /&gt;
	 *   element collapsible - that is, hide entire tables and lists (instead&lt;br /&gt;
	 *   of hiding only all rows but first of tables, and hiding each list&lt;br /&gt;
	 *   item separately for lists) and don't wrap other elements in&lt;br /&gt;
	 *   div.mw-collapsible-content. May only be used with custom togglers.&lt;br /&gt;
	 * @return {jQuery}&lt;br /&gt;
	 * @chainable&lt;br /&gt;
	 */&lt;br /&gt;
	$.fn.makeCollapsible = function ( options ) {&lt;br /&gt;
		options = options || {};&lt;br /&gt;
&lt;br /&gt;
		this.each( function () {&lt;br /&gt;
			var $collapsible, collapseText, expandText, $caption, $toggle, actionHandler, buildDefaultToggleLink,&lt;br /&gt;
				premadeToggleHandler, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval;&lt;br /&gt;
&lt;br /&gt;
			// Ensure class &amp;quot;mw-collapsible&amp;quot; is present in case .makeCollapsible()&lt;br /&gt;
			// is called on element(s) that don't have it yet.&lt;br /&gt;
			$collapsible = $( this ).addClass( 'mw-collapsible' );&lt;br /&gt;
&lt;br /&gt;
			// Return if it has been enabled already.&lt;br /&gt;
			if ( $collapsible.data( 'mw-made-collapsible' ) ) {&lt;br /&gt;
				return;&lt;br /&gt;
			} else {&lt;br /&gt;
				$collapsible.data( 'mw-made-collapsible', true );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Use custom text or default?&lt;br /&gt;
			collapseText = options.collapseText || $collapsible.attr( 'data-collapsetext' ) || mw.msg( 'collapsible-collapse' );&lt;br /&gt;
			expandText = options.expandText || $collapsible.attr( 'data-expandtext' ) || mw.msg( 'collapsible-expand' );&lt;br /&gt;
&lt;br /&gt;
			// Default click/keypress handler and toggle link to use when none is present&lt;br /&gt;
			actionHandler = function ( e, opts ) {&lt;br /&gt;
				var defaultOpts = {&lt;br /&gt;
					toggleClasses: true,&lt;br /&gt;
					toggleText: { collapseText: collapseText, expandText: expandText }&lt;br /&gt;
				};&lt;br /&gt;
				opts = $.extend( defaultOpts, options, opts );&lt;br /&gt;
				togglingHandler( $( this ), $collapsible, e, opts );&lt;br /&gt;
			};&lt;br /&gt;
			// Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).&lt;br /&gt;
			buildDefaultToggleLink = function () {&lt;br /&gt;
				return $( '&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;' )&lt;br /&gt;
					.text( collapseText )&lt;br /&gt;
					.wrap( '&amp;lt;span class=&amp;quot;mw-collapsible-toggle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;' )&lt;br /&gt;
						.parent()&lt;br /&gt;
						.prepend( '&amp;lt;span class=&amp;quot;mw-collapsible-bracket&amp;quot;&amp;gt;[&amp;lt;/span&amp;gt;' )&lt;br /&gt;
						.append( '&amp;lt;span class=&amp;quot;mw-collapsible-bracket&amp;quot;&amp;gt;]&amp;lt;/span&amp;gt;' )&lt;br /&gt;
						.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );&lt;br /&gt;
			};&lt;br /&gt;
&lt;br /&gt;
			// Default handler for clicking on premade toggles&lt;br /&gt;
			premadeToggleHandler = function ( e, opts ) {&lt;br /&gt;
				var defaultOpts = { toggleClasses: true, linksPassthru: true };&lt;br /&gt;
				opts = $.extend( defaultOpts, options, opts );&lt;br /&gt;
				togglingHandler( $( this ), $collapsible, e, opts );&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;
			if ( options.$customTogglers ) {&lt;br /&gt;
				$customTogglers = $( options.$customTogglers );&lt;br /&gt;
			} else {&lt;br /&gt;
				collapsibleId = $collapsible.attr( 'id' ) || '';&lt;br /&gt;
				if ( collapsibleId.indexOf( 'mw-customcollapsible-' ) === 0 ) {&lt;br /&gt;
					$customTogglers = $( '.' + collapsibleId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) )&lt;br /&gt;
						.addClass( 'mw-customtoggle' );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Add event handlers to custom togglers or create our own ones&lt;br /&gt;
			if ( $customTogglers &amp;amp;&amp;amp; $customTogglers.length ) {&lt;br /&gt;
				actionHandler = function ( e, opts ) {&lt;br /&gt;
					var defaultOpts = {};&lt;br /&gt;
					opts = $.extend( defaultOpts, options, opts );&lt;br /&gt;
					togglingHandler( $( this ), $collapsible, e, opts );&lt;br /&gt;
				};&lt;br /&gt;
&lt;br /&gt;
				$toggleLink = $customTogglers&lt;br /&gt;
					.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )&lt;br /&gt;
					.prop( 'tabIndex', 0 );&lt;br /&gt;
&lt;br /&gt;
			} else {&lt;br /&gt;
				// If this is not a custom case, do the default: wrap the&lt;br /&gt;
				// contents and add the toggle link. Different elements are&lt;br /&gt;
				// treated differently.&lt;br /&gt;
&lt;br /&gt;
				if ( $collapsible.is( 'table' ) ) {&lt;br /&gt;
&lt;br /&gt;
					// If the table has a caption, collapse to the caption&lt;br /&gt;
					// as opposed to the first row&lt;br /&gt;
					$caption = $collapsible.find( '&amp;gt; caption' );&lt;br /&gt;
					if ( $caption.length ) {&lt;br /&gt;
						$toggle = $caption.find( '&amp;gt; .mw-collapsible-toggle' );&lt;br /&gt;
&lt;br /&gt;
						// If there is no toggle link, add it to the end of the caption&lt;br /&gt;
						if ( !$toggle.length ) {&lt;br /&gt;
							$toggleLink = buildDefaultToggleLink().appendTo( $caption );&lt;br /&gt;
						} else {&lt;br /&gt;
							actionHandler = premadeToggleHandler;&lt;br /&gt;
							$toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )&lt;br /&gt;
								.prop( 'tabIndex', 0 );&lt;br /&gt;
						}&lt;br /&gt;
					} else {&lt;br /&gt;
						// The toggle-link will be in one of the cells (td or th) of the first row&lt;br /&gt;
						$firstItem = $collapsible.find( 'tr:first th, tr:first td' );&lt;br /&gt;
						$toggle = $firstItem.find( '&amp;gt; .mw-collapsible-toggle' );&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;
							$toggleLink = buildDefaultToggleLink().prependTo( $firstItem.eq( -1 ) );&lt;br /&gt;
						} else {&lt;br /&gt;
							actionHandler = premadeToggleHandler;&lt;br /&gt;
							$toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )&lt;br /&gt;
								.prop( 'tabIndex', 0 );&lt;br /&gt;
						}&lt;br /&gt;
					}&lt;br /&gt;
&lt;br /&gt;
				} else if ( $collapsible.parent().is( 'li' ) &amp;amp;&amp;amp;&lt;br /&gt;
					$collapsible.parent().children( '.mw-collapsible' ).length === 1 &amp;amp;&amp;amp;&lt;br /&gt;
					$collapsible.find( '&amp;gt; .mw-collapsible-toggle' ).length === 0&lt;br /&gt;
				) {&lt;br /&gt;
					// special case of one collapsible in &amp;lt;li&amp;gt; tag&lt;br /&gt;
					$toggleLink = buildDefaultToggleLink();&lt;br /&gt;
					$collapsible.before( $toggleLink );&lt;br /&gt;
				} else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {&lt;br /&gt;
					// The toggle-link will be in the first list-item&lt;br /&gt;
					$firstItem = $collapsible.find( 'li:first' );&lt;br /&gt;
					$toggle = $firstItem.find( '&amp;gt; .mw-collapsible-toggle' );&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'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 '-1', others return 0, null or undefined.&lt;br /&gt;
						firstval = $firstItem.prop( 'value' );&lt;br /&gt;
						if ( firstval === undefined || !firstval || firstval === '-1' || firstval === -1 ) {&lt;br /&gt;
							$firstItem.prop( 'value', '1' );&lt;br /&gt;
						}&lt;br /&gt;
						$toggleLink = buildDefaultToggleLink();&lt;br /&gt;
						$toggleLink.wrap( '&amp;lt;li class=&amp;quot;mw-collapsible-toggle-li&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;' ).parent().prependTo( $collapsible );&lt;br /&gt;
					} else {&lt;br /&gt;
						actionHandler = premadeToggleHandler;&lt;br /&gt;
						$toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )&lt;br /&gt;
							.prop( 'tabIndex', 0 );&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 = $collapsible.find( '&amp;gt; .mw-collapsible-toggle' );&lt;br /&gt;
&lt;br /&gt;
					// If a direct child .content-wrapper does not exists, create it&lt;br /&gt;
					if ( !$collapsible.find( '&amp;gt; .mw-collapsible-content' ).length ) {&lt;br /&gt;
						$collapsible.wrapInner( '&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;' );&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;
						$toggleLink = buildDefaultToggleLink().prependTo( $collapsible );&lt;br /&gt;
					} else {&lt;br /&gt;
						actionHandler = premadeToggleHandler;&lt;br /&gt;
						$toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )&lt;br /&gt;
							.prop( 'tabIndex', 0 );&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			$( this ).data( 'mw-collapsible', {&lt;br /&gt;
				collapse: function () {&lt;br /&gt;
					actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: false } );&lt;br /&gt;
				},&lt;br /&gt;
				expand: function () {&lt;br /&gt;
					actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: true } );&lt;br /&gt;
				},&lt;br /&gt;
				toggle: function () {&lt;br /&gt;
					actionHandler.call( $toggleLink.get( 0 ), null, null );&lt;br /&gt;
				}&lt;br /&gt;
			} );&lt;br /&gt;
&lt;br /&gt;
			// Initial state&lt;br /&gt;
			if ( options.collapsed || $collapsible.hasClass( 'mw-collapsed' ) ) {&lt;br /&gt;
				// One toggler can hook to multiple elements, and one element can have&lt;br /&gt;
				// multiple togglers. This is the sanest way to handle that.&lt;br /&gt;
				actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: false } );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
		} );&lt;br /&gt;
&lt;br /&gt;
		/**&lt;br /&gt;
		 * Fired after collapsible content has been initialized&lt;br /&gt;
		 *&lt;br /&gt;
		 * This gives an option to modify the collapsible behavior.&lt;br /&gt;
		 *&lt;br /&gt;
		 * @event wikipage_collapsibleContent&lt;br /&gt;
		 * @member mw.hook&lt;br /&gt;
		 * @param {jQuery} $content All the elements that have been made collapsible&lt;br /&gt;
		 */&lt;br /&gt;
		mw.hook( 'wikipage.collapsibleContent' ).fire( this );&lt;br /&gt;
&lt;br /&gt;
		return this;&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	/**&lt;br /&gt;
	 * @class jQuery&lt;br /&gt;
	 * @mixins jQuery.plugin.makeCollapsible&lt;br /&gt;
	 */&lt;br /&gt;
&lt;br /&gt;
}( jQuery, mediaWiki ) );&lt;/div&gt;</summary>
		<author><name>S.H.O.</name></author>	</entry>

	</feed>