Jump to content

User talk:The Transhumanist/Sandbox199

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
/*
var content = document.getElementById('mw-content-text');
var whattohide = content.innerHTML.replace(/–/g,'');
content.innerHTML = whattohide;
*/

// ==========================================================================================

/*
var content = document.getElementById('mw-body-content');
var whattohide = content.innerHTML.replace(/Chess;/g,'');
content.innerHTML = whattohide;
*/

// ==========================================================================================

/*
//List item processor
//This script removes en dashes from list items. 
//It is a test script, which will be developed into one for toggling list item annotations. 
//Based on a script by Writ Keeper.

//This selector grabs all of the <li> elements that are within #mw-content-text, and then does something for each of them
$("#mw-content-text li").each( function (ind, el) 
{ 
  //first, grab the text from the current li element; we want only the top level text, so filter out all of the other stuff.
  var currentText = $(el).contents().filter(function(){return this.nodeType === 3; });

  //Don't bother processing if there's nothing to process
  if(currentText.text().length > 0)
  {
     //replace the character
     var newText = currentText.text().replace(/–/g,'');  
     
     //reinsert the updated string back into the DOM
     currentText.replaceWith(newText);
  }
});
*/

// ==========================================================================================

/*
///Test script by TheDJ
// For processing list items:
// to replace each en dash with XXX
// Based on:
//	https://en.wikipedia.org/w/index.php?title=User:TheDJ/thetranshumanist.js&oldid=746366603
	by TheDJ

var i = 0;
i++;
// This runs immediately.
// It is safe to do things like this, UNLESS they need to change something in the page.
// You CAN use it to do data processing, start requests to the api etc.

// A anonymous function block wrapped inside $()
$( function() {
	// do stuff to change the page
});
// $() is an alias for jQuery(), the main function of the jQuery library,
// which is always available for script writers on Wikipedia
// When used like this, it is a shortcut for $( document ).ready(), and it will
// execute your anonymous function as soon as the page is ready to be
// manipulated by JS, or immediately if it is ready now.
// See also: http://api.jquery.com/jquery/#jQuery3

// Attach a function to be run once the 'wikipage.content' part of a page is available
mw.hook( 'wikpage.content').add( function ($content ) {
	// Like document.ready, this will run once that part of the page is
	// ready/updated.
	// $content is a jQuery list of DOM elements, that has just become available.
	// See also: http://api.jquery.com/jquery/
});
// This is used by many scripts in MediaWiki, because it also works after
// saving with Visual Editor, or when previewing with Live preview tools etc.
// There are several such named hooks like:
// wikipage.diff, wikipage.editform, wikipage.categories

// mw, an alias for mediaWiki, is another javascript libary that is always
// to MediaWiki and Wikipedia scripters.
// See also: https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw
// For the hook specific part of this library, which we use above, see:
// https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.hook

// Note that large parts of this mw library are not ready for usage by default,
// and you might have to load some parts using mw.loader, before they can be used.
// For loading dependencies and guaranteeing order between dependencies,
// use ResourceLoader.
// See also: https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Client-side_.28dynamically.29


// Example 
if ( mw.config.get('wgAction') === 'view' ) {
	mw.hook( 'wikipage.content').add( function ($contents) {
		// Get all the <li> elements from $contents, but skip those with a class or ID,
		// because they might have special functionality that you don't want to break.
		// We generally avoid things like this, because they will break easily
		// Wikipedia is so diverse and big, that to do anything,
		// your content really needs a class or ID.
		var listItems = $contents.find( 'li:not([class]):not([id])' );
		
		// Iterate over each of the <li> items
		listItems.each( function( index, li ) {
			// This part is complicated, because we need to look at text
			// and text is not structured. Get the li item, and wrap it with jquery
			// Then get all the direct children nodes
			var nodes = $(li).contents();
			var marker = false;
			var ul = false;
			for ( var i = 0; i < nodes.length; i++ ) {
				// We need to find text nodes, that have our - marker.
				if ( nodes[i].nodeType === Node.TEXT_NODE && 
					nodes[i].textContent.indexOf(' – ') >= 0)
				{
					// We found the node which contains our marker
					marker = i;
					break;
				}
			}
			// Check to see if the last node is an UL, so we don't break nesting
			if( nodes[nodes.length-1].tagName === "UL" ) {
				ul = nodes[nodes.length-1];
			}
			
			// only useful if it's the second element or later
			if( marker > 0 ) {
				// Use jquery to create a new span
				// We use span, because it is an inline element.
				// We give it a class so we can find it back later
				// This element is already part of the document, but it is not attached to anything visible yet.
				var wrapper = $('<span>').addClass('myscript-wrapper');
				// Move the node with our marker, and all nodes that follow it into this new wrapper.
				// This removes them from the original <li>
				wrapper.append(nodes.slice(marker, ul ? nodes.length-1 : nodes.length));
				// Append the wrapper to our original list item to make the wrapper visible.
				$(li).append(wrapper);
				if ( ul ) {
					$(li).append( ul );
				}
			}
		});
		
		// Now we have structure, and we can apply our manipulations and functionality
		// We simply hide all our elements
		$( '.myscript-wrapper' ).hide();
		// You would now add controls to show them etc. etc.
	});
}

*/


// ==========================================================================================

/* anno.js: (Will) add a button to toggle visibility of annotations in lists. 

Currently, it is being tested on the ID element 'content'.

Based on based on: https://en.wikipedia.org/w/index.php?title=User:PleaseStand/hide-vector-sidebar.js&oldid=580854231  */

( function ( mw, $ ) {
    var annoSwitch;

    function annoHide() {
        document.getElementById( 'content' ).style.visibility = 'hidden';
        if ( annoSwitch ) {
            annoSwitch.parentNode.removeChild(annoSwitch);
        }
        annoSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Hide anno', 'ca-anno', 'Hide the navigation links', 'a' );
        $( annoSwitch ).click( function ( e ) {
            e.preventDefault();
            annoShow();
        } );
    }
   
    function annoShow() {
        document.getElementById( 'content' ).style.visibility = '';
        if ( annoSwitch ) {
            annoSwitch.parentNode.removeChild(annoSwitch);
        }
        annoSwitch = mw.util.addPortletLink( 'p-cactions', '#', 'Hide anno', 'ca-anno', 'Hide the navigation links', 'a' );
        $( annoSwitch ).click( function ( e ) {
            e.preventDefault();
            annoHide();
        } );
    }
   
    // Only activate on Vector skin
    if ( mw.config.get( 'skin' ) === 'vector' ) {
        $( function() {
            // Change this if you want to hide annotations by default
            annoShow();
        } );
    }
   
}( mediaWiki, jQuery ) );

// ==========================================================================================

// Another approach to hide stuff (originally worked on 'p')

$(document).ready(function(){
$('li').each(function () {
    var $this = $(this);
   $this.html($this.text().replace(/\b – \b/g, '<span style="display:none">quick</span>'));
    });
});

// ==========================================================================================

$(document).ready(function(){
    $("li:contains( – )").css("background-color", "orange");
});

// ==========================================================================================

$(document).ready(function() {
    function walkTheDOM(node, func) {
        // Walk the DOM recursively, applying func to each node.
        // Nodes can be any node in the DOM, including elements,
        // text nodes and comments. 
        func(node);
        node = node.firstChild;
        while (node) {
            walkTheDOM(node, func);
            node = node.nextSibling;
        }
    }

    $("li:contains( – )").each(function (index, elem) {
        // For each li element found by the selector, walk the DOM to
        // find the first dash. Once we have found it, remove
        // everything after it.
        var foundDash = false;
        walkTheDOM(elem, function (node) {
            if (foundDash) {
                // We found the first dash already, so remove the node
                // if it is of an appropriate type.
                if (node.nodeType === 1) {
                    // The current node is an element
                    $(node).remove();
                } else if (node.nodeType === 3) {
                    // The current node is a text node
                    node.nodeValue = "";
                }
            } else if (node.nodeType === 3) {
                // The current node is a text node, and we haven't found the
                // first dash yet, so check whether it is there.
                var dashIndex = node.nodeValue.indexOf(" – ");
                if (dashIndex >= 0) {
                    // We found the first dash, so split the text node in two
                    // where we found it, and blank the second one.
                    var nodeToRemove = node.splitText(dashIndex);
                    nodeToRemove.nodeValue = '';
                    foundDash = true;
                }
            }
        });
    });
});

// ==========================================================================================

/**
 * jQuery makeCollapsible
 *
 * Dual licensed:
 * - CC BY 3.0 <http://creativecommons.org/licenses/by/3.0>
 * - GPL2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 *
 * @class jQuery.plugin.makeCollapsible
 */
( function ( $, mw ) {

    /**
     * Handler for a click on a collapsible toggler.
     *
     * @private
     * @param {jQuery} $collapsible
     * @param {string} action The action this function will take ('expand' or 'collapse').
     * @param {jQuery|null} [$defaultToggle]
     * @param {Object|undefined} [options]
     */
    function toggleElement( $collapsible, action, $defaultToggle, options ) {
        var $collapsibleContent, $containers, hookCallback;
        options = options || {};

        // Validate parameters

        // $collapsible must be an instance of jQuery
        if ( !$collapsible.jquery ) {
            return;
        }
        if ( action !== 'expand' && action !== 'collapse' ) {
            // action must be string with 'expand' or 'collapse'
            return;
        }
        if ( $defaultToggle === undefined ) {
            $defaultToggle = null;
        }
        if ( $defaultToggle !== null && !$defaultToggle.jquery ) {
            // is optional (may be undefined), but if defined it must be an instance of jQuery.
            // If it's not, abort right away.
            // After this $defaultToggle is either null or a valid jQuery instance.
            return;
        }

        // Trigger a custom event to allow callers to hook to the collapsing/expanding,
        // allowing the module to be testable, and making it possible to
        // e.g. implement persistence via cookies
        $collapsible.trigger( action === 'expand' ? 'beforeExpand.mw-collapsible' : 'beforeCollapse.mw-collapsible' );
        hookCallback = function () {
            $collapsible.trigger( action === 'expand' ? 'afterExpand.mw-collapsible' : 'afterCollapse.mw-collapsible' );
        };

        // Handle different kinds of elements

        if ( !options.plainMode && $collapsible.is( 'table' ) ) {
            // Tables
            // If there is a caption, hide all rows; otherwise, only hide body rows
            if ( $collapsible.find( '> caption' ).length ) {
                $containers = $collapsible.find( '> * > tr' );
            } else {
                $containers = $collapsible.find( '> tbody > tr' );
            }
            if ( $defaultToggle ) {
                // Exclude table row containing togglelink
                $containers = $containers.not( $defaultToggle.closest( 'tr' ) );
            }

            if ( action === 'collapse' ) {
                // Hide all table rows of this table
                // Slide doesn't work with tables, but fade does as of jQuery 1.1.3
                // http://stackoverflow.com/questions/467336#920480
                if ( options.instantHide ) {
                    $containers.hide();
                    hookCallback();
                } else {
                    $containers.stop( true, true ).fadeOut().promise().done( hookCallback );
                }
            } else {
                $containers.stop( true, true ).fadeIn().promise().done( hookCallback );
            }

        } else if ( !options.plainMode && ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) ) {
            // Lists
            $containers = $collapsible.find( '> li' );
            if ( $defaultToggle ) {
                // Exclude list-item containing togglelink
                $containers = $containers.not( $defaultToggle.parent() );
            }

            if ( action === 'collapse' ) {
                if ( options.instantHide ) {
                    $containers.hide();
                    hookCallback();
                } else {
                    $containers.stop( true, true ).slideUp().promise().done( hookCallback );
                }
            } else {
                $containers.stop( true, true ).slideDown().promise().done( hookCallback );
            }

        } else {
            // Everything else: <div>, <p> etc.
            $collapsibleContent = $collapsible.find( '> .mw-collapsible-content' );

            // If a collapsible-content is defined, act on it
            if ( !options.plainMode && $collapsibleContent.length ) {
                if ( action === 'collapse' ) {
                    if ( options.instantHide ) {
                        $collapsibleContent.hide();
                        hookCallback();
                    } else {
                        $collapsibleContent.slideUp().promise().done( hookCallback );
                    }
                } else {
                    $collapsibleContent.slideDown().promise().done( hookCallback );
                }

            // Otherwise assume this is a customcollapse with a remote toggle
            // .. and there is no collapsible-content because the entire element should be toggled
            } else {
                if ( action === 'collapse' ) {
                    if ( options.instantHide ) {
                        $collapsible.hide();
                        hookCallback();
                    } else {
                        if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {
                            $collapsible.fadeOut().promise().done( hookCallback );
                        } else {
                            $collapsible.slideUp().promise().done( hookCallback );
                        }
                    }
                } else {
                    if ( $collapsible.is( 'tr' ) || $collapsible.is( 'td' ) || $collapsible.is( 'th' ) ) {
                        $collapsible.fadeIn().promise().done( hookCallback );
                    } else {
                        $collapsible.slideDown().promise().done( hookCallback );
                    }
                }
            }
        }
    }

    /**
     * Handle clicking/keypressing on the collapsible element toggle and other
     * situations where a collapsible element is toggled (e.g. the initial
     * toggle for collapsed ones).
     *
     * @private
     * @param {jQuery} $toggle the clickable toggle itself
     * @param {jQuery} $collapsible the collapsible element
     * @param {jQuery.Event|null} e either the event or null if unavailable
     * @param {Object|undefined} options
     */
    function togglingHandler( $toggle, $collapsible, e, options ) {
        var wasCollapsed, $textContainer, collapseText, expandText;
        options = options || {};

        if ( e ) {
            if (
                e.type === 'click' &&
                options.linksPassthru &&
                $.nodeName( e.target, 'a' ) &&
                $( e.target ).attr( 'href' ) &&
                $( e.target ).attr( 'href' ) !== '#'
            ) {
                // Don't fire if a link with href !== '#' was clicked, if requested  (for premade togglers by default)
                return;
            } else if ( e.type === 'keypress' && e.which !== 13 && e.which !== 32 ) {
                // Only handle keypresses on the "Enter" or "Space" keys
                return;
            } else {
                e.preventDefault();
                e.stopPropagation();
            }
        }

        // This allows the element to be hidden on initial toggle without fiddling with the class
        if ( options.wasCollapsed !== undefined ) {
            wasCollapsed = options.wasCollapsed;
        } else {
            wasCollapsed = $collapsible.hasClass( 'mw-collapsed' );
        }

        // Toggle the state of the collapsible element (that is, expand or collapse)
        $collapsible.toggleClass( 'mw-collapsed', !wasCollapsed );

        // Toggle the mw-collapsible-toggle classes, if requested (for default and premade togglers by default)
        if ( options.toggleClasses ) {
            $toggle
                .toggleClass( 'mw-collapsible-toggle-collapsed', !wasCollapsed )
                .toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed );
        }

        // Toggle the text ("Show"/"Hide"), if requested (for default togglers by default)
        if ( options.toggleText ) {
            collapseText = options.toggleText.collapseText;
            expandText = options.toggleText.expandText;

            $textContainer = $toggle.find( '> a' );
            if ( !$textContainer.length ) {
                $textContainer = $toggle;
            }
            $textContainer.text( wasCollapsed ? collapseText : expandText );
        }

        // And finally toggle the element state itself
        toggleElement( $collapsible, wasCollapsed ? 'expand' : 'collapse', $toggle, options );
    }

    /**
     * Enable collapsible-functionality on all elements in the collection.
     *
     * - Will prevent binding twice to the same element.
     * - Initial state is expanded by default, this can be overridden by adding class
     *   "mw-collapsed" to the "mw-collapsible" element.
     * - Elements made collapsible have jQuery data "mw-made-collapsible" set to true.
     * - The inner content is wrapped in a "div.mw-collapsible-content" (except for tables and lists).
     *
     * @param {Object} [options]
     * @param {string} [options.collapseText] Text used for the toggler, when clicking it would
     *   collapse the element. Default: the 'data-collapsetext' attribute of the
     *   collapsible element or the content of 'collapsible-collapse' message.
     * @param {string} [options.expandText] Text used for the toggler, when clicking it would
     *   expand the element. Default: the 'data-expandtext' attribute of the
     *   collapsible element or the content of 'collapsible-expand' message.
     * @param {boolean} [options.collapsed] Whether to collapse immediately. By default
     *   collapse only if the elements has the 'mw-collapsible' class.
     * @param {jQuery} [options.$customTogglers] Elements to be used as togglers
     *   for this collapsible element. By default, if the collapsible element
     *   has an id attribute like 'mw-customcollapsible-XXX', elements with a
     *   *class* of 'mw-customtoggle-XXX' are made togglers for it.
     * @param {boolean} [options.plainMode=false] Whether to use a "plain mode" when making the
     *   element collapsible - that is, hide entire tables and lists (instead
     *   of hiding only all rows but first of tables, and hiding each list
     *   item separately for lists) and don't wrap other elements in
     *   div.mw-collapsible-content. May only be used with custom togglers.
     * @return {jQuery}
     * @chainable
     */
    $.fn.makeCollapsible = function ( options ) {
        options = options || {};

        this.each( function () {
            var $collapsible, collapseText, expandText, $caption, $toggle, actionHandler, buildDefaultToggleLink,
                premadeToggleHandler, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval;

            // Ensure class "mw-collapsible" is present in case .makeCollapsible()
            // is called on element(s) that don't have it yet.
            $collapsible = $( this ).addClass( 'mw-collapsible' );

            // Return if it has been enabled already.
            if ( $collapsible.data( 'mw-made-collapsible' ) ) {
                return;
            } else {
                $collapsible.data( 'mw-made-collapsible', true );
            }

            // Use custom text or default?
            collapseText = options.collapseText || $collapsible.attr( 'data-collapsetext' ) || mw.msg( 'collapsible-collapse' );
            expandText = options.expandText || $collapsible.attr( 'data-expandtext' ) || mw.msg( 'collapsible-expand' );

            // Default click/keypress handler and toggle link to use when none is present
            actionHandler = function ( e, opts ) {
                var defaultOpts = {
                    toggleClasses: true,
                    toggleText: { collapseText: collapseText, expandText: expandText }
                };
                opts = $.extend( defaultOpts, options, opts );
                togglingHandler( $( this ), $collapsible, e, opts );
            };
            // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).
            buildDefaultToggleLink = function () {
                return $( '<a>' )
                    .attr( {
                        role: 'button',
                        tabindex: 0
                    } )
                    .text( collapseText )
                    .wrap( '<span class="mw-collapsible-toggle"></span>' )
                        .parent()
                        .prepend( '<span class="mw-collapsible-bracket">[</span>' )
                        .append( '<span class="mw-collapsible-bracket">]</span>' )
                        .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler );
            };

            // Default handler for clicking on premade toggles
            premadeToggleHandler = function ( e, opts ) {
                var defaultOpts = { toggleClasses: true, linksPassthru: true };
                opts = $.extend( defaultOpts, options, opts );
                togglingHandler( $( this ), $collapsible, e, opts );
            };

            // Check if this element has a custom position for the toggle link
            // (ie. outside the container or deeper inside the tree)
            if ( options.$customTogglers ) {
                $customTogglers = $( options.$customTogglers );
            } else {
                collapsibleId = $collapsible.attr( 'id' ) || '';
                if ( collapsibleId.indexOf( 'mw-customcollapsible-' ) === 0 ) {
                    $customTogglers = $( '.' + collapsibleId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) )
                        .addClass( 'mw-customtoggle' );
                }
            }

            // Add event handlers to custom togglers or create our own ones
            if ( $customTogglers && $customTogglers.length ) {
                actionHandler = function ( e, opts ) {
                    var defaultOpts = {};
                    opts = $.extend( defaultOpts, options, opts );
                    togglingHandler( $( this ), $collapsible, e, opts );
                };

                $toggleLink = $customTogglers
                    .on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                    .prop( 'tabIndex', 0 );

            } else {
                // If this is not a custom case, do the default: wrap the
                // contents and add the toggle link. Different elements are
                // treated differently.

                if ( $collapsible.is( 'table' ) ) {

                    // If the table has a caption, collapse to the caption
                    // as opposed to the first row
                    $caption = $collapsible.find( '> caption' );
                    if ( $caption.length ) {
                        $toggle = $caption.find( '> .mw-collapsible-toggle' );

                        // If there is no toggle link, add it to the end of the caption
                        if ( !$toggle.length ) {
                            $toggleLink = buildDefaultToggleLink().appendTo( $caption );
                        } else {
                            actionHandler = premadeToggleHandler;
                            $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                .prop( 'tabIndex', 0 );
                        }
                    } else {
                        // The toggle-link will be in one of the cells (td or th) of the first row
                        $firstItem = $collapsible.find( 'tr:first th, tr:first td' );
                        $toggle = $firstItem.find( '> .mw-collapsible-toggle' );

                        // If theres no toggle link, add it to the last cell
                        if ( !$toggle.length ) {
                            $toggleLink = buildDefaultToggleLink().prependTo( $firstItem.eq( -1 ) );
                        } else {
                            actionHandler = premadeToggleHandler;
                            $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                                .prop( 'tabIndex', 0 );
                        }
                    }

                } else if ( $collapsible.parent().is( 'li' ) &&
                    $collapsible.parent().children( '.mw-collapsible' ).length === 1 &&
                    $collapsible.find( '> .mw-collapsible-toggle' ).length === 0
                ) {
                    // special case of one collapsible in <li> tag
                    $toggleLink = buildDefaultToggleLink();
                    $collapsible.before( $toggleLink );
                } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {
                    // The toggle-link will be in the first list-item
                    $firstItem = $collapsible.find( 'li:first' );
                    $toggle = $firstItem.find( '> .mw-collapsible-toggle' );

                    // If theres no toggle link, add it
                    if ( !$toggle.length ) {
                        // Make sure the numeral order doesn't get messed up, force the first (soon to be second) item
                        // to be "1". Except if the value-attribute is already used.
                        // If no value was set WebKit returns "", Mozilla returns '-1', others return 0, null or undefined.
                        firstval = $firstItem.prop( 'value' );
                        if ( firstval === undefined || !firstval || firstval === '-1' || firstval === -1 ) {
                            $firstItem.prop( 'value', '1' );
                        }
                        $toggleLink = buildDefaultToggleLink();
                        $toggleLink.wrap( '<li class="mw-collapsible-toggle-li"></li>' ).parent().prependTo( $collapsible );
                    } else {
                        actionHandler = premadeToggleHandler;
                        $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                            .prop( 'tabIndex', 0 );
                    }

                } else { // <div>, <p> etc.

                    // The toggle-link will be the first child of the element
                    $toggle = $collapsible.find( '> .mw-collapsible-toggle' );

                    // If a direct child .content-wrapper does not exists, create it
                    if ( !$collapsible.find( '> .mw-collapsible-content' ).length ) {
                        $collapsible.wrapInner( '<div class="mw-collapsible-content"></div>' );
                    }

                    // If theres no toggle link, add it
                    if ( !$toggle.length ) {
                        $toggleLink = buildDefaultToggleLink().prependTo( $collapsible );
                    } else {
                        actionHandler = premadeToggleHandler;
                        $toggleLink = $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler )
                            .prop( 'tabIndex', 0 );
                    }
                }
            }

            $( this ).data( 'mw-collapsible', {
                collapse: function () {
                    actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: false } );
                },
                expand: function () {
                    actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: true } );
                },
                toggle: function () {
                    actionHandler.call( $toggleLink.get( 0 ), null, null );
                }
            } );

            // Initial state
            if ( options.collapsed || $collapsible.hasClass( 'mw-collapsed' ) ) {
                // One toggler can hook to multiple elements, and one element can have
                // multiple togglers. This is the sanest way to handle that.
                actionHandler.call( $toggleLink.get( 0 ), null, { instantHide: true, wasCollapsed: false } );
            }

        } );

        /**
         * Fired after collapsible content has been initialized
         *
         * This gives an option to modify the collapsible behavior.
         *
         * @event wikipage_collapsibleContent
         * @member mw.hook
         * @param {jQuery} $content All the elements that have been made collapsible
         */
        mw.hook( 'wikipage.collapsibleContent' ).fire( this );

        return this;
    };

    /**
     * @class jQuery
     * @mixins jQuery.plugin.makeCollapsible
     */

}( jQuery, mediaWiki ) );


// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================

Start a discussion about improving the User:The Transhumanist/Sandbox199 page

Start a discussion