Manual:Interface/JavaScript/ja

MediaWiki:Common.js はすべての利用者向けに読み込まれる JavaScript を含んでいます. ご利用のウィキの検索ボックスに「MediaWiki:Common.js」を入力してください. ページが存在しない場合はそのように表示されます. その場合、かつ必要なをお持ちの場合は、実行する必要があるコードを含むページを作成してください. これには類似のページ群があり、そちらは特定のを使用している利用者のみに影響します (下記参照).

に true が設定されている場合は、利用者は自身のインターフェイスのみをカスタマイズでき、そのためには自身の利用者下位ページに「小文字」のページ名で個人のスクリプトを作成/取り込みをします (下記参照). 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.

Global scripts

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

Personal scripts
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.

Site-wide
Some additional site-wide variables are present only depending on the wiki configuration.

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

Page specific (Wikibase)
Some additional informations will be available when the site supports Wikibase:

User-specific
Related to the user currently viewing the page:

Hooks for extensions

 * ResourceLoaderGetConfigVars: Since MediaWiki 1.17 extensions can add their own site-wide variables through this hook.
 * MakeGlobalVariablesScript: 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 ResourceLoaderGetConfigVars hook instead.