User:Paxed/JQueryWithUI
< User:Paxed
Jump to navigation
Jump to search
Revision as of 00:05, 11 December 2010 by Ilmari Karonen (talk | contribs) (the ?> isn't actually needed; use syntaxhighlight since we've got it)
To make JQuery v1.4.4 and JQuery-UI v1.8.6 work on NetHackWiki (which uses MediaWiki 1.16), I made a quick'n'dirty extension.
Installation
- Download JQuery and JQuery-UI, and unzip them into your_wiki_dir/extensions/JQueryWithUI/
- Save the code below as your_wiki_dir/extensions/JQueryWithUI/JQueryWithUI.php
- Edit the code so it links to the versions of JQuery and JQuery-UI you set up. (In the code, those are 1.4.4 and 1.8.6)
- Add require_once("$IP/extensions/JQueryWithUI/JQueryWithUI.php"); to the end of your LocalSettings.php
Code for JQueryWithUI.php
<?php
/**
* JQueryWithUI - a MediaWiki extension that provides the JQuery and JQueryUI
*/
if ( !defined( 'MEDIAWIKI' ) ) die();
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'JQuery With UI',
'version' => 0.1,
'author' => '[http://nethackwiki.com/wiki/User:Paxed Pasi Kallinen]',
'url' => 'http://nethackwiki.com/wiki/User:Paxed/JQueryWithUI',
'description' => 'Adds JQuery and JQuery-UI to MW 1.16',
);
$wgHooks['BeforePageDisplay'][] = 'wfJQueryWithUIHeaders';
function wfJQueryWithUIHeaders() {
global $wgOut;
wfOutputJQueryWithUIHeaders($wgOut);
return true;
}
function wfOutputJQueryWithUIHeaders($outputPage) {
global $wgJsMimeType, $wgStylePath, $wgScriptPath;
$outputPage->addLink(
array(
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => $wgScriptPath.'/extensions/JQueryWithUI/css/smoothness/jquery-ui-1.8.6.custom.css'
)
);
$outputPage->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/JQueryWithUI/js/jquery-1.4.4.min.js\"></script>\n");
$outputPage->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/JQueryWithUI/js/jquery-ui-1.8.6.custom.min.js\"></script>\n");
}