(forked from https://www.mediawiki.org/w/index.php?oldid=766696#Format) Tag: Help |
(condense intro) Tag: Help |
||
Line 1: | Line 1: | ||
[[File:Gadgets-special.png|Special:Gadgets|thumb|right|250px]] |
[[File:Gadgets-special.png|Special:Gadgets|thumb|right|250px]] |
||
− | '''Gadgets''' allow users to pick [[Help:CSS and JS customization|JavaScript (JS) or CSS-based]] "gadgets" that other community users provide. |
+ | '''Gadgets''' allow users to pick [[Help:CSS and JS customization|JavaScript (JS) or CSS-based]] "gadgets" that other community users provide. These are usually configured in [[MediaWiki:Gadgets-definition]] using the following syntax, where each field is separated by <code>|</code>: |
− | These are usually configured in [[MediaWiki:Gadgets-definition]] using the following syntax, where each field is separated by <code>|</code>: |
||
<pre> |
<pre> |
||
* mygadget|mygadget.js|mygadget.css |
* mygadget|mygadget.js|mygadget.css |
||
</pre> |
</pre> |
||
− | The first field sets up the internal name of the gadget. The other fields are <code>MediaWiki:Gadget-*</code> pages that will be loaded for the user. |
+ | The first field sets up the internal name of the gadget. The other fields are <code>MediaWiki:Gadget-*</code> pages that will be loaded for the user. In the above example, mygadget: |
− | |||
− | In the above example, mygadget: |
||
* has definition text at [{{fullurl:MediaWiki:Gadget-mygadget}} MediaWiki:Gadget-mygadget] |
* has definition text at [{{fullurl:MediaWiki:Gadget-mygadget}} MediaWiki:Gadget-mygadget] |
||
* will load [{{fullurl:MediaWiki:Gadget-mygadget.js}} MediaWiki:Gadget-mygadget.js] and [{{fullurl:MediaWiki:Gadget-mygadget.css}} MediaWiki:Gadget-mygadget.css]. |
* will load [{{fullurl:MediaWiki:Gadget-mygadget.js}} MediaWiki:Gadget-mygadget.js] and [{{fullurl:MediaWiki:Gadget-mygadget.css}} MediaWiki:Gadget-mygadget.css]. |
||
− | It's possible to configure '''options''' in the first field of your gadgets. |
+ | It's possible to also configure '''options''' in the first field of your gadgets. |
Examples: |
Examples: |
||
+ | |||
<pre> |
<pre> |
||
* mygadget[ResourceLoader]|mygadget.js|mygadget.css |
* mygadget[ResourceLoader]|mygadget.js|mygadget.css |
||
Line 23: | Line 21: | ||
<pre> |
<pre> |
||
[option1 | option2 | ... optionN] |
[option1 | option2 | ... optionN] |
||
⚫ | |||
− | </pre> |
||
⚫ | |||
option = value1, value2, value3 |
option = value1, value2, value3 |
||
To enable it by default use "<code>default</code>": |
To enable it by default use "<code>default</code>": |
||
+ | |||
<pre> |
<pre> |
||
* mygadget[ResourceLoader|default|dependencies=mediawiki.util]|mygadget.js|mygadget.css |
* mygadget[ResourceLoader|default|dependencies=mediawiki.util]|mygadget.js|mygadget.css |
||
Line 33: | Line 31: | ||
To make the gadget available only to users with appropriate permissions, set the <tt>rights</tt> option. For example, |
To make the gadget available only to users with appropriate permissions, set the <tt>rights</tt> option. For example, |
||
+ | |||
<pre> |
<pre> |
||
* mygadget[rights=foo,bar]|mygadget.js|mygadget.css |
* mygadget[rights=foo,bar]|mygadget.js|mygadget.css |
Revision as of 17:48, 29 January 2019
Gadgets allow users to pick JavaScript (JS) or CSS-based "gadgets" that other community users provide. These 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:
- has definition text at MediaWiki:Gadget-mygadget
- will load MediaWiki:Gadget-mygadget.js and MediaWiki:Gadget-mygadget.css.
It's possible to also configure options in the first field of your gadgets.
Examples:
* mygadget[ResourceLoader]|mygadget.js|mygadget.css * mygadget[ ResourceLoader | rights=foo, bar ] | mygadget.js | mygadget.css
Option format
[option1 | option2 | ... optionN]
whitespace can be omitted. Single option can either consist of single option name (in this case it is a flag option), or contain a comma-separated list of values:
option = value1, value2, value3
To enable it 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
Available options
Here's all the gadget options available:
Name | Parameters | Description | Since |
---|---|---|---|
ResourceLoader | None | Marks gadget's scripts as compatible with ResourceLoader. | ? |
dependencies | Comma-separated ResourceLoader module names | See list of modules available by default. 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. | ? |
skins | Comma-separated skin names | Makes the gadget visible in preferences only to users who have these skins. | ? |
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. | 1.18 |
References
This page contains content sourced from MediaWiki.org (CC-BY-SA).