Community Central
Community Central
(expand)
m (→‎Further help and feedback: Mass editing of links)
Tag: Help
(45 intermediate revisions by 31 users not shown)
Line 1: Line 1:
 
{{Available on request}}
 
{{Available on request}}
  +
{{tocright}}
'''Gadgets''' is an extension that allows users to pick JavaScript or CSS based "gadgets" that other wiki users provide.
 
  +
'''Gadgets''' deliver [[Help:CSS and JS customization|custom JavaScript (JS) or CSS]] to users who ''want'' to use it. Unlike code in [[MediaWiki:Common.js]] or [[MediaWiki:Wikia.css]], Gadget-enabled JS and CSS isn't seen by every user. Instead, the user ''chooses'' to enable or disable the code in their [[Help:Preferences|preferences]] under a tab labeled "Gadgets".
   
  +
Therefore, gadgets are perhaps best thought of as a way to provide your wiki's users with optional site-wide experiences.
They're designed using JavaScript and/or CSS snippets located on pages in the MediaWiki namespace. Each gadget is added by adding a new entry to [[MediaWiki:Gadgets-definition]], providing a name and description for the gadget, and a list of the JS and CSS snippets that it uses (see the Usage section below).
 
   
  +
:''This page gives you an overview of the process. For greater detail, please slide over to [[Help:Gadgets/options|this page]].''
Gadgets use the same principle as [[MediaWiki:Monaco.js]], [[MediaWiki:Common.css]], etc because they allow scripting or styling over the entire site. Since Gadgets function in this manner (the list that enables them as well as the actual JS and CSS pages), it requires being a wiki admin to manage these, just like the sitewide JS or CSS.
 
  +
== An extension ==
  +
Gadgets are available on a wiki only after the community has sent in a [[Special:Contact|message to staff]] requesting that the feature — or [[Help:Extensions|''extension'']] — be enabled. The ''default'' condition of a Fandom wiki is to '''''not''''' have gadgets. The chances are that the wiki you're currently on won't have gadgets.
   
  +
One other minor detail: the upper-case ''Gadgets'' typically refers to the extension itself, while the lower-case ''gadget'' typically means any individual item enabled through the extension.
== Usage ==
 
  +
== Defining a gadget ==
  +
Once the Gadgets extension has been enabled on your wiki, create the list of gadgets in [[Special:Preferences]] from which your users can choose. To do this, write entries in [[MediaWiki:Gadgets-definition]] that provide a name and description for the gadget, and a list of the JS and CSS snippets that it uses. It doesn't matter at this point whether the JS and CSS pages actually exist on your wiki; starting with the definitions lays down the names of the files that you can then create.
  +
== Getting a list of gadgets on a wiki ==
  +
[[File:Gadgets-preferences.png|thumb|300px|A typical Gadgets section of Special:Preferences|right]]
 
When your Gadget definitions are set up, the gadgets will appear in the "Gadgets" section of everyone's preferences, so users can choose which gadgets fit their community's needs. An overview of added gadgets can be found on [{{fullurl:Special:Gadgets}} Special:Gadgets], along with links to the respective pages that define them, which allows for better control over the wikis's gadgets. The headings that appear in your preferences may also be redefined here.
   
  +
:''Searching for Special:Gadgets in the Fandom search bar is a quick way of determining whether the Gadgets extension is enabled on the wiki.''
First you need to add a script or style to a page in the MediaWiki namespace (e.g. [[MediaWiki:Gadget-navpop.css]] ). Then you add that page to [[MediaWiki:Gadgets-definition]] as shown here:
 
   
  +
== How to set up a gadget ==
<pre>
 
  +
[[File:Gadgets-special.png|thumb|300px|The way Special:Gadgets looks|right]]
* Navigation_popups|popups.js|navpop.css
 
  +
All custom Gadget MediaWiki namespace pages that you create must be prefixed with '''Gadget-''' — like '''MediaWiki:Gadget-MyGreatStyle.css''' or '''MediaWiki:Gadget-ThisIsSomeCoolJavascript.js'''.
* contribsrange|contribsrange.js
 
</pre>
 
   
  +
:''As with any JavaScript on Fandom, '''Gadget-enabled JS must go through the [[Help:JavaScript review process|JavaScript review process]]''', so it will not be immediately available for your wiki to use. And, like other sitewide pages, Gadgets may only be written using JS and CSS.''
The first field is the gadget's internal name, and may only contain alphanumberic (letters and numbers only) in order to function correctly. If the internal name is '''Navigation_popups''', the corresponding MediaWiki namespace page will be '''[[MediaWiki:Gadget-Navigation popups]]'''. This page allows you to define a description text which will be displayed on the '''Gadgets''' section of your [[Special:Preferences|preferences]].
 
   
  +
=== Basic example ===
The second and subsequent fields define the pages that make up the code. In the above example, '''popups.js''' and '''navpop.css''' would be '''[[MediaWiki:Gadget-popups.js]]''' and '''[[MediaWiki:Gadget-navpop.css]]''' respectively. Like other sitewide pages, Gadgets may only be written using JS and CSS pages.
 
  +
Let's say you have a gadget called '''CoolGadget'''. You want to call a bit of JS and have it styled by some CSS. To do that, you'd create a line, preceded by an asterisk, within your '''MediaWiki:Gadgets-definition''' page. It might look something like this:
   
  +
:<code><nowiki>* CoolGadget|JavaScript.js|Style.css</nowiki></code>
These defined pages will allow the gadget to appear in the "Gadgets" section of everyone's [[Special:Preferences|preferences]], so users can choose which gadgets fit their wiki needs. An overview of added gadgets can be found on [[Special:Gadgets]], along with links to the respective pages that define them, which allows for better control over the wiki's gadgets.
 
   
  +
If the gadget were ''purely'' JS-based, not requiring any special CSS, you'd do this:
Please note that all Gadget MediaWiki namespace pages must be prefixed with '''Gadget-''', the only exception is where you define them in [[MediaWiki:Gadgets-definition]] as displayed in the above example.
 
   
  +
:<code><nowiki>* CoolGadget|JavaScript.js</nowiki></code>
== See also ==
 
   
 
The first field is the gadget's user-facing name. It may only contain letters and numbers in order to function correctly. If the name is '''CoolGadget''', the corresponding MediaWiki namespace page will be '''MediaWiki:Gadget-CoolGadget'''. This page is crucial, because it allows you to define a description text which will be displayed on the '''Gadgets''' section of your [[Special:Preferences|preferences]].
*[[mediawikiwiki:Extension:Gadgets|Extension:Gadgets]]
 
  +
 
The second and subsequent fields define the pages that make up the code. In the above example, '''JavaScript.js''' and '''Style.css''' would be '''MediaWiki:Gadget-JavaScript.js''' and '''MediaWiki:Gadget-Style.css''', respectively.
  +
  +
==== Important notes ====
  +
* Please make sure that you give your readers a '''''reasonable''''' summary of what the gadget does on its description page ('''MediaWiki:Gadget-CoolGadget''', for example). Don't say it does one thing — when in fact it does something completely different. Remember, the whole point of gadgets is to give your users a '''choice''' about how to experience your wiki. And for that, users need accurate information.
  +
* We've deliberately chosen different names for each of these three components — name, JS page and CSS page — just to make things super clear for this basic example. In practice, on a wiki with many different gadgets, you'd probably keep all the names the same to differentiate them from ''other'' gadgets. For instance, you'd probably have '''MediaWiki:Gadget-CoolGadget''' (name), '''MediaWiki:Gadget-CoolGadget.js''' (JS), and '''MediaWiki:Gadget-CoolGadget.css''' (CSS).
  +
 
== See also ==
  +
*See [[Help:Gadgets/options]] for more detail on gadget configuration
  +
*[[mw:Extension:Gadgets|Extension:Gadgets]] - on MediaWiki.org, upon which this page was originally based
  +
*[[Help:Extensions]] - A guide to all the extensions Fandom offers
   
  +
== Further help and feedback ==
[[Category:Expand|{{PAGENAME}}]]
 
  +
{{Help and feedback section}}[[es:Ayuda:Gadgets]]
  +
[[fr:Aide:Gadgets]]
  +
[[ja:ヘルプ:ガジェット]]
  +
[[pl:Pomoc:Gadgets]]
  +
[[pt:Ajuda:Gadgets]]
  +
[[ru:Справка:Гаджеты]]
  +
[[tr:Yardım:Gadgetlar]]
  +
[[uk:Довідка:Гаджети]]
  +
[[zh:Help:插件]]
 
[[Category:Help|{{PAGENAME}}]]
 
[[Category:Help|{{PAGENAME}}]]

Revision as of 07:02, 1 December 2019

This extension is not enabled by default but may be available upon request.

Gadgets deliver custom JavaScript (JS) or CSS to users who want to use it. Unlike code in MediaWiki:Common.js or MediaWiki:Wikia.css, Gadget-enabled JS and CSS isn't seen by every user. Instead, the user chooses to enable or disable the code in their preferences under a tab labeled "Gadgets".

Therefore, gadgets are perhaps best thought of as a way to provide your wiki's users with optional site-wide experiences.

This page gives you an overview of the process. For greater detail, please slide over to this page.

An extension

Gadgets are available on a wiki only after the community has sent in a message to staff requesting that the feature — or extension — be enabled. The default condition of a Fandom wiki is to not have gadgets. The chances are that the wiki you're currently on won't have gadgets.

One other minor detail: the upper-case Gadgets typically refers to the extension itself, while the lower-case gadget typically means any individual item enabled through the extension.

Defining a gadget

Once the Gadgets extension has been enabled on your wiki, create the list of gadgets in Special:Preferences from which your users can choose. To do this, write entries in MediaWiki:Gadgets-definition that provide a name and description for the gadget, and a list of the JS and CSS snippets that it uses. It doesn't matter at this point whether the JS and CSS pages actually exist on your wiki; starting with the definitions lays down the names of the files that you can then create.

Getting a list of gadgets on a wiki

Gadgets-preferences

A typical Gadgets section of Special:Preferences

When your Gadget definitions are set up, the gadgets will appear in the "Gadgets" section of everyone's preferences, so users can choose which gadgets fit their community's needs. An overview of added gadgets can be found on Special:Gadgets, along with links to the respective pages that define them, which allows for better control over the wikis's gadgets. The headings that appear in your preferences may also be redefined here.

Searching for Special:Gadgets in the Fandom search bar is a quick way of determining whether the Gadgets extension is enabled on the wiki.

How to set up a gadget

Gadgets-special

The way Special:Gadgets looks

All custom Gadget MediaWiki namespace pages that you create must be prefixed with Gadget- — like MediaWiki:Gadget-MyGreatStyle.css or MediaWiki:Gadget-ThisIsSomeCoolJavascript.js.

As with any JavaScript on Fandom, Gadget-enabled JS must go through the JavaScript review process, so it will not be immediately available for your wiki to use. And, like other sitewide pages, Gadgets may only be written using JS and CSS.

Basic example

Let's say you have a gadget called CoolGadget. You want to call a bit of JS and have it styled by some CSS. To do that, you'd create a line, preceded by an asterisk, within your MediaWiki:Gadgets-definition page. It might look something like this:

* CoolGadget|JavaScript.js|Style.css

If the gadget were purely JS-based, not requiring any special CSS, you'd do this:

* CoolGadget|JavaScript.js

The first field is the gadget's user-facing name. It may only contain letters and numbers in order to function correctly. If the name is CoolGadget, the corresponding MediaWiki namespace page will be MediaWiki:Gadget-CoolGadget. This page is crucial, because it allows you to define a description text which will be displayed on the Gadgets section of your preferences.

The second and subsequent fields define the pages that make up the code. In the above example, JavaScript.js and Style.css would be MediaWiki:Gadget-JavaScript.js and MediaWiki:Gadget-Style.css, respectively.

Important notes

  • Please make sure that you give your readers a reasonable summary of what the gadget does on its description page (MediaWiki:Gadget-CoolGadget, for example). Don't say it does one thing — when in fact it does something completely different. Remember, the whole point of gadgets is to give your users a choice about how to experience your wiki. And for that, users need accurate information.
  • We've deliberately chosen different names for each of these three components — name, JS page and CSS page — just to make things super clear for this basic example. In practice, on a wiki with many different gadgets, you'd probably keep all the names the same to differentiate them from other gadgets. For instance, you'd probably have MediaWiki:Gadget-CoolGadget (name), MediaWiki:Gadget-CoolGadget.js (JS), and MediaWiki:Gadget-CoolGadget.css (CSS).

See also

Further help and feedback