FANDOM


Gadgets-special

Special:Gadgets

This page explains some of the configuration options available for gadgets.

General set up

Gadget options are usually set in MediaWiki:Gadgets-definition. There, you use the following syntax, where each field is separated by pipes:

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:

  • has definition text at MediaWiki:Gadget-mygadget
  • will load MediaWiki:Gadget-mygadget.js and MediaWiki:Gadget-mygadget.css.

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 make the gadget available only to users with appropriate permissions, set the rights option. For example:

* mygadget[rights=foo,bar]|mygadget.js|mygadget.css
NOTE: Rights are not user groups. Declaring a user group will make the gadget accessible to no one. Instead, a user right must be declared from Special:ListGroupRights, and then all users who have access to that user right will be able to use the gadget. For example, declaring the skipcaptcha user right would make a gadget available to almost 10 different user groups, whereas nominornewtalk would make a gadget available to only one — the bot user group.

Here are some other options:

Name Parameters Description
ResourceLoader None Marks gadget's scripts as compatible with ResourceLoader.
Note: ResourceLoader should be declared for most JS files on UCP wikis, or else an error in Special:Gadgets may be displayed and the JS not executed.
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.

Please don't use default option

While it is technically possible to set gadgets as default, this option should not be used on Fandom.

That's because default gadgets display for unregistered users, and there's no way for these users to disable the gadget. Thus, you're taking away their choice to use the gadget. You're also reversing the gadget's logic for registered users; default gadgets must be turned off, instead of opted into. Both situations work against the main intent of the Gadgets extension.

If you want CSS or JS to apply to all users, please use the main JS and CSS pages on your wiki.

References

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

See also

Community content is available under CC-BY-SA unless otherwise noted.