Extension:ShowHide

The ShowHide extension enables creation of wiki elements which could be shown and hidden, like Table of Contents.

The idea for this came after Avala was criticised for creating a list of non-aligned countries, similar to the list of NATO members. On the one hand, the list is perfectly logical, on the other, completely impractical. This extension would make such lists possible. I remembered this idea when I saw some articles on Serbian Wikipedia, for example Бановићи, and the bottom of the page on George H. W. Bush.

The extension could be seen in action at Wikimedia SCG's crash wiki ShowHide test page. Due to its nature, no examples can be given here; you should visit the test page to see several examples and test how it works.

The link above is dead

Note that the extension is not thoroughly tested, and there might be bugs. Currently, it is in use on the Veggie Van Gogh wiki.

The request to implement this feature in Mediawiki is at bug #1257.

Related
IIRC there are lots of related extensions / functions in MW. Unfortunately I can't find them right now. Please replace this text with some related stuff.
 * Extension:ToggleDisplay

Syntax
Syntax is a bit more advanced than what is usual for an extension:

Some text (usually title) which will not be hidden __HIDER__ Text which will be hidden

__HIDER__ is the place where link will be put which will show or hide the text between tags. In the above example, it will be the string "Text which will be hidden".

If tags are used, the text will be shown by default, and could be hidden by clicking on hider.

I created a patch that remove __HIDER__ from syntax --a.i.

Source
''Helpful hint: the copyright symbol and the script tags are messing up the display. Edit this page to copy the code! --Bytesmiths 03:14, 20 December 2005 (UTC)''

v 0.1.1
PHP5 version with corrections according to Smerf's comments.
 * Note the following version does not work correctly for me on MediaWiki 1.5. The following will work correctly on the first load, but after loading from cache, the one-time Javascript code inserted by $wgOut->addHtml does not get added leading to problems. v.0.1 above works fine for me.

Other
Yet another version, by Austin Che, exists at http://austin.mit.edu/mediawiki/showhide.php.txt

without $wgOut (patch 3; ParserBeforeStrip and ParserAfterStrip hooks ware enabled) This patch was tested on mediawiki 1.8.2 (firefox2 and Konqueror) --a.i.

And if you want to change button text, apply next patch too --a.i.

Additional syntax is  or .  is also possible.

I created a new patch of below, and have overridden old below version. But it was reverted automatically unfortunately. Please remove below that old unnecessary version someone can remove it (and also this text). -- a.i.

without $wgOut --a.i.