Extension:HeaderScriptInjector

Summary
This extension creates $wgHeader global variable, pointing to the object of class 'HeaderScriptInjector'. You will be able to access functions of this extension through $wgHeader.

To use HeaderScriptInjector in your extension, within your extension file add a line: global $wgHeader;

Libraries, local javascript files, css will be added through method calls:

All scripts/libraries/style sheets loaded through the HeaderScriptInjector will be added to the header only once.

Add library from CDN
Attach a javascript library hosted by an external content distribution network (CDN) to your extension. i.e. you won't need to copy source of javascript to your server, page response might be faster due to possibly better robustness of the CDN

At the moment only Google Ajax libraries API is supported.

Check the list of libraries and their versions supported by Google AJAX libraries API.

Installation
Go to root of your wiki installation, then type

If you don't have svn installed on your server, get this file, put it in the extensions/HeaderScriptInjector directory and name it HeaderScriptInjector.php

Then in your LocalSettings.php add:

If you are using Google AJAX library CDN you will need to add your Google API Key. Add a line in LocalSettings.php after "require_once".