Manual:Interface/JavaScript/zh

MediaWiki:Common.js 包含将为所有用户加载的 JavaScript. 在蒐尋框中輸入「MediaWiki:Common.js」， 然後系統會告訴您該頁面是否不存在. 如果該頁不存在，你需要有權限才能創建它. 有的頁面僅影響特定的用戶(請參閱下文).

如果 被設為真，用戶可以通過在某些用戶子頁面中創建和導入個人腳本來為自己定製界面. 讓網站管理員和用戶更容易共享 JavaScript ，請參閱.

本頁將涵蓋可以使用的狀態和配置變數. 有關常用的 JavaScript API ，請參見 JSDuck documentation.

JavaScript 頁面列表
Note that any .js and any gadget won't load on Special:Preferences itself.

全局脚本

 * 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

用户脚本
They're only available if is set to.


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

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

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

All pages (user/page-specific)
Related to the user currently viewing the page:

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

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

Hooks for 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.