MediaWiki extensions manual
OOjs UI icon advanced.svg
Release status: unmaintained
Implementation User interface
Description Loads JavaScript files from selected files or directories without duplication.
Author(s) Aran Dunkley (Nadtalk)
Latest version 3.0.8 (2012-02-15)
MediaWiki 1.17+
Database changes No
License GPL v2+
Translate the Javascript extension if it is available at translatewiki.net
Check usage and version matrix.

Manage multiple JavaScript file imports from one place. The extension is a single script which you can obtain from here and save into a directory called JavaScript in your extensions directory and include in your LocalSettings.php file. Save all the necessary *.js files into the same locations as the script and they will automatically be loaded by your wiki.

Using an external script or scripts has several advantages to using MediaWiki:Common.js:

  • only people with access to the file system on the server can edit the script(s) or upload new version(s)
  • you can have as many scripts as you like, which facilitates modularization
  • users often find that it takes a while for updates to MediaWiki:Common.js to propagate to the client (browser). This can make developing and testing your script a frustrating experience. Updates to external scripts, on the other hand, tend to take effect on the client after a single force refresh. This is also the case using this extension.
  • editing MediaWiki:Common.js through the edit window in Mediawiki is cumbersome and error prone. External scripts can be edited in a proper editor with full screen text display, graphical syntax indication and feedback on errors. Of course you can copy MediaWiki:Common.js to an external location and edit it there, but this gives you essentially two versions to keep track of (even if one may be only temporary).
  • if your application requires much JavaScript, MediaWiki:Common.js may be edited very frequently. This takes up unnecessary space in your wiki's database. You avoid this using external scripts.

The original script has some issues. A revised version has been added to the Discussion page.

To activate the extension, include in your LocalSettings.php file as in the following example:



See alsoEdit