This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored.
Release status: unmaintained
|Description||Inject scripts, CSS, load popular JS libraries from Google Ajax API into the HTML header of your wiki|
|Latest version||0.1 (2008-11-29)|
|MediaWiki||1.12 (will probably work on earlier versions)|
localisation updates provided by Translatewiki.net.
|Translate the HeaderScriptInjector extension if it is available at translatewiki.net|
|Check usage and version matrix.|
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:
$wgHeader->loadLib(...); //more details below $wgHeader->addScript($url); //if your script depends on libraries add libraries before! $wgHeader->addCSS($url); $wgHeader->loadGoogleApi(); //this is also called implicitly by loadLib() if the libraries are loaded through the Google CDN
All scripts/libraries/style sheets loaded through the HeaderScriptInjector will be added to the header only once.
Add library from CDNEdit
At the moment only Google Ajax libraries API is supported.
$wgHeader->loadLib("jquery","google","1.2.6"); ^ ^ ^ library tag CDN version of the library (please, make sure to use correct values)
Check the list of libraries and their versions supported by Google AJAX libraries API.
|Yahoo User Interface||yui|
Go to root of your wiki installation, then type
cd extensions mkdir HeaderScriptInjector cd HeaderScriptInjector svn checkout http://mw-header-script-injector.googlecode.com/svn/trunk/ mw-header-script-injector-read-only .
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".
$wgGoogleApiKey = '....';