MediaWiki:Common.js
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
This is JavaScript for all users. Any changes to this page should first be proposed on its talk page or in Wikisource's Central Discussion portal.
Please note that changes are visible within minutes. You can also Testing can be done on your personal in the interim if you wish to refresh the content sooner. Errors you make here can disrupt the entire library, so make sure you know what you are doing. common.js oder skin-specific JS file. |
//<syntaxhighlight lang="javascript">
/**
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
* loaded for all users on every wiki page. If possible create a gadget that is
* enabled by default instead of adding it here (since gadgets are fully
* optimized ResourceLoader modules with possibility to add dependencies etc.)
*
* Since Common.js isn't a gadget, there is no place to declare its
* dependencies, so we have to lazy load them with mw.loader.using on demand and
* then execute the rest in the callback. In most cases these dependencies will
* be loaded (or loading) already and the callback will not be delayed. In case a
* dependency hasn't arrived yet it'll make sure those are loaded before this.
*/
/* global mw, $, importStylesheet, importScript */
/* jshint curly:false, strict:false, eqnull:true, browser:true */
var dependencies = []; // e.g. ['mediawiki.user', 'mediawiki.util', 'jquery.client']
mw.loader.using(dependencies).done(function () {
/*
* Add any needed code here. But please don't unless absolutely necessary!
*
*/
}); /* End of mw.loader.using callback */
/* DO NOT ADD CODE BELOW THIS LINE */
//</syntaxhighlight>