Extension:SectionHide

The SectionHide extension adds a [hide] link wherever there is a section heading [edit] link. This link will hide all content between that section header and the next section header of the same level, changing itself to read [show] in the process. Clicking [show] will restore the section to view.

Example
Illustration showing how each hide link conceals the related block in a nested fashion while keeping the title visible.



Mediawiki:Common.js
Add this here, or in individual skins

Versions
Added a hide/show all link at the top
 * Version 1.1

Added an option to keep the content before the first X-1 headings visible when using the hide all link. NB set to 1 to hide everything from the first heading to the end.
 * Version 1.2

Using anything other than 1 means that divs are overlapping instead of nested, which is a standards violation in xhtml . Mediawiki is still using HTML, however, so overlapping is tolerated and most browsers deal with it. Some may have issues. By the same token, any divs in the actual text that cross over headings will potentially cause a problem, which is why every closing tag added has an id attribute to match it with the opening tag.

added an opt-out error if installed alongside header tabs
 * Version 1.3

Added an option to use images (NB gifs only but change the javascript if you want to use pngs or jpegs) instead of/alongside words - as per requested feature
 * Version 1.4

Allow hideall to be disabled with setting less than zero - as requested

Resolved issues with display under Vector skin, resulting from renaming editsection class to mw-editsection in 1.22. Validated in 1.23.2
 * Version 1.5

Added an option on request to show the link before the title (on purpose this time) and two more to change or leave out the brackets
 * Version 1.6

Tweaked the closing div tag handling to avoid parser issues
 * Version 1.7

Author Notes
Several similar extensions were created in the past, but they are not maintained and didn't do quite what I needed.