Manual:Interface/JavaScript/fr

MediaWiki:Common.js contient le JavaScript qui sera chargé pour tous les utilisateurs. Entrez MediaWiki:Common.js dans la boîte de recherche de votre wiki. It will tell you if the page doesn't exist; if so, and you have the necessary, just create it with the code you need to execute. There are similar pages affecting only users of specific (see below).

If is set to true, users can customize the interface for only themselves by creating and importing personal scripts in user subpages with lowercase titles (see below). makes it easier for site admins and users to share JavaScript, see.

This page covers the state and configuration variables available. For the general JavaScript API, see the JSDuck documentation.

Scripts globaux

 * MediaWiki:Common.js (all skins, but ignored by the mobile website provided by )
 * MediaWiki:skinname.js (per skin, for example MediaWiki:Vector.js)
 * (per user group, for example MediaWiki:Group-sysop.js)
 * MediaWiki:Mobile.js (specific to the mobile website and provided by )
 * Special:Gadgets

Scripts personnels
They're only available if is set to true.


 * User:Example/common.js (all skins - introduced in MW v1.17)
 * User:Example/skinname.js (per skin, for example User:Example/vector.js)
 * User:Example/global.js (per wiki family, if Extension:GlobalCssJs is in use in for this family)

To ease JavaScript programming, the MediaWiki software exposes a number of configuration values in an object called mw.config.

Note Most of these variables have a wg prefix.
 * For legacy reasons these names are exposed as global JavaScript variables if is true, so they use a prefix to avoid collisions.
 * A subset of these names correspond to $wg variables in PHP, but others are unrelated.
 * Besides the names in this list, many extensions also set additional JavaScript config variables prefixed with 'wg'.

These values can be accessed through, documented at ResourceLoader/Core modules.

Toutes les pages (spécifiques à l'utilisateur ou la page)
Related to the user currently viewing the page:

Quelques pages
Some additional variables are present only depending on the page namespace, wiki configuration and/or user preferences.

Page spécifique (extension Wikibase)
Some additional informations will be available when the site supports Wikibase:

Accroches pour les extensions

 * : Since MediaWiki 1.17 extensions can add their own site-wide variables through this hook.
 * : Since MediaWiki 1.14 extensions can add their own variables to the OutputPage. If the variable is not dependent on the page being viewed, use the hook instead.