Extension:Javascript

Manage multiple Javascript files imports from one place. The extension is a single script which you can obtain from OrganicDesign:Extension:Javascript.php and save into a directory called Javascript in your extensions directory and include in your LocalSettings.php file. Set the $wgJavascriptPaths to an array containing all the relative url locations of the directories and Javascript files you want added, this must be defined before the include line as in the following example, In this example, the scripts are all located in the same directory as the extension script. The last javascriptToolbox item is a directory containing a number of related Javascript files which will all be imported.

Note that if this extension is included in your LocalSettings.php after all the other extensions, then those extensions may also add Javascript files to the $wgJavascriptPaths list to be imported.

Finding the correct paths and testing
Once you've saved your Javascript files in the locations you want them on your server, find the correct URL for them by typing the address into your browser, if it is correct you'll be able to load the Javascript file directly and see it in the browser. You can then use the part of the URL after the domain name as your correct relative path.

You can check which scripts have successfully been included by checking the Special:Version page, it shows links to the scripts it has loaded, following the link should take you to the Javascript file in the browser. If the script links are not showing up, then the extension could not find them at the path specified by $wgJavascriptPaths in your LocalSettings.php.