Community Central
Community Central
Gadgets-special

Special:Gadgets

Gadgets allow users to pick JavaScript (JS) or CSS-based "gadgets" that other community users provide. This page details how to configure a gadget.

Gadgets are usually configured in MediaWiki:Gadgets-definition using the following syntax, where each field is separated by |:

* mygadget|mygadget.js|mygadget.css

The first field sets up the internal name of the gadget. The other fields are MediaWiki:Gadget-* pages that will be loaded for the user. In the above example, mygadget:

It's possible to configure options in the first field of your gadgets. For example:

* mygadget[ResourceLoader]|mygadget.js|mygadget.css
* mygadget[ ResourceLoader | rights=foo, bar ] | mygadget.js | mygadget.css

Option format

[option1 | option2 | ... optionN]

Whitespace can be omitted. The brackets are wrapped around either:

  • single option name (in this case it is a flag option), OR
  • contain a comma-separated list of values:
option = value1, value2, value3

Available options

To enable a gadget by default use "default":

* mygadget[ResourceLoader|default|dependencies=mediawiki.util]|mygadget.js|mygadget.css

To make the gadget available only to users with appropriate permissions, set the rights option. For example:

* mygadget[rights=foo,bar]|mygadget.js|mygadget.css

There's four gadget options available:

Name Parameters Description
ResourceLoader None Marks gadget's scripts as compatible with ResourceLoader.
dependencies Comma-separated ResourceLoader module names Note that this option has no effect if current gadget has no ResourceLoader-compatible resources (i.e. no styles and scripts not marked as compatible).
rights Comma-separated privilege names Disable the gadget (and make it invisible in preferences) for users who do not have these privileges.
default None Makes the gadget enabled by default for everyone (including anons!) having the required user rights. Registered users can still disable it in their preferences.

References

This page contains content sourced from MediaWiki.org (CC-BY-SA).

See also