Difference between revisions of "User:Paxed/JQueryWithUI"
Jump to navigation
Jump to search
(document briefly the extension.) |
m (the ?> isn't actually needed; use syntaxhighlight since we've got it) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 7: | Line 7: | ||
* Add <tt>require_once("$IP/extensions/JQueryWithUI/JQueryWithUI.php");</tt> to the end of your LocalSettings.php | * Add <tt>require_once("$IP/extensions/JQueryWithUI/JQueryWithUI.php");</tt> to the end of your LocalSettings.php | ||
− | + | ==Code for JQueryWithUI.php== | |
− | Code for JQueryWithUI.php | + | <source lang="PHP"> |
− | < | ||
<?php | <?php | ||
/** | /** | ||
Line 22: | Line 21: | ||
'version' => 0.1, | 'version' => 0.1, | ||
'author' => '[http://nethackwiki.com/wiki/User:Paxed Pasi Kallinen]', | 'author' => '[http://nethackwiki.com/wiki/User:Paxed Pasi Kallinen]', | ||
− | 'url' => 'http://nethackwiki.com/wiki/ | + | 'url' => 'http://nethackwiki.com/wiki/User:Paxed/JQueryWithUI', |
'description' => 'Adds JQuery and JQuery-UI to MW 1.16', | 'description' => 'Adds JQuery and JQuery-UI to MW 1.16', | ||
); | ); | ||
Line 43: | Line 42: | ||
) | ) | ||
); | ); | ||
− | $outputPage->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/JQueryWithUI/js/jquery-1.4.4.min.js\"></ | + | $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"); | |
− | $outputPage->addScript( "<script type=\"{$wgJsMimeType}\" src=\"$wgScriptPath/extensions/JQueryWithUI/js/jquery-ui-1.8.6.custom.min. | ||
− | js\"></script>\n"); | ||
} | } | ||
− | + | </source> | |
− | </ |
Latest revision as of 00:05, 11 December 2010
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");
}