Help:Extension:GlobalCssJs/zh

The GlobalCssJs extension allow users to create a JavaScript page and a CSS page to be loaded in every wiki of a wiki farm. If you go to Special:Preferences >  on any wiki where the extension is enabled you'll find links to your global scripts and style sheets:  meta:Special:MyPage/global.cssmeta:Special:MyPage/global.js On Wikimedia wikis, these global customizations are hosted on Meta-Wiki.

变量
When adding scripts to your global.js, be aware that, as with gadgets, variables declared with " " are not attached to the  object: they are local variables whose scope is a wrapper function inserted by ResourceLoader to implement the global module (which is called " "). Therefore, if you plan to move a local script to the global module, and it needs to define global variables, make sure you use the syntax " " to declare them.

Explicit URLs
Functions like  will not work because those use the local wiki; they do not use a page with this name on the global wiki. Therefore you will need to pass a full URL to load the script.

排除某个维基
If you want to exclude a specific wiki, E.g. English Wikisource, you can wrap all or part of your global.js with:

例子：设置一个全维基的界面语言
Note: Extension:GlobalPreferences (if present) provides this functionality more conveniently.

全域样式表（CSS）
Note: Any  lines must be at the top.

Per-skin customization
Currently the extension does not provide global CSS/JS for specific skins, but it is possible to customize the appearance of a specific skin globally by using classes such as "skin-vector" and "skin-monobook", which are added to the body element automatically by MediaWiki. You can use the  selector to skip just one skin, e.g.   to not apply the rule to the mobile skin.