Extension:JSToggler

What can this extension do?
This extension allows the user to create javascript buttons without having to use any actual javascript code. This buttons allow the user to hide/show blocks of content dynamicaly.

Creating the button
this will create a button. However it is recommended that you set the group and the name. read further for more info.

Creating the div
this will create the div. Same as above, the group and name attributes should be set.

General arguments
This arguments control the behavior of the buttons and divs. They can be used both in the jsbutton and jsdiv tags

Name
This is the most important argument. We don't want all divs to be toggled by all buttons, we want each div to toggle a single button. To allow this we only need to set a div and a button with the same name attribute and that button will toggle that div with the same 'name'

Warning: Do not use default as name!

Example:

In this example, when you toggle the sample button, the 'sample div' will be altered, but the 'sample div2' will not

Group
The name allows the assignment of buttons to divs. But when we set the 'type' attribute to 'multi', all divs will be hidden but one. We may need to divide the buttons and divs in groups, so, when a 'multi' button is pressed, only the divs from one group are closed.

Warning: Do not use default as group!

Example:

In this example, when sample button is pressed, sample div 1 display attribute will be altered, and sample div2 will be hidden. However, no matter how many times the button is pressed, since they are in different groups, sample div's 3 and 4 will never be altered.

Button specific arguments
This arguments will only be valid if used in the jsbutton tags

Type
This argument controls the button behavior through divs in the same group. By default it is set to 'single', but if it is set to 'multi', all divs in the same group as the one with the same name as the button will be set as hidden on button press. The type attributte also accpets the 'group' value. With this value, this button will hide or show all divs in the same group.

Example:

In this example, when sample button is pressed, sample div 1 display attribute will be altered, and sample div 2 ad 3 will be hidden. However, no matter how many times the button is pressed, since they are in different groups, sample div 4 will never be altered. When sample group button is pressed, all divs in g1 will be hidden or shown, regardless of their current state.

Altering the CSS
All  tags, by default, are div tags with class and id set to "JSTButton". Just edit them as you like in your css style sheet.

Download instructions
Please cut and paste the code found below and place it in  and. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: