06/08/04 03:14:05
>>442
ないみたいね。
[[MediaWiki:Common.js]]を有効にするエクステンションを書いてみた。
<?php
if( !defined('MEDIAWIKI') ) die( 'This file is a MediaWiki extension, not a valid entry point.' );
$wgExtensionFunctions[] = 'efRegisterCommonSiteScript';
function efRegisterCommonSiteScript() {
global $wgHooks;
$wgHooks['BeforePageDisplay'][] = array( 'efAddCommonSiteScript' );
}
function efAddCommonSiteScript( &$out ) {
global $wgUseSiteJs, $wgJsMimeType, $wgSquidMaxage;
if( !$wgUseSiteJs ) return;
$title = Title::makeTitle( NS_MEDIAWIKI, 'Common.js' );
if( is_null( $title ) ) return;
$script = Xml::Element( 'script', array(
'type' => $wgJsMimeType,
'src' => $title->getLocalURL( 'action=raw&ctype=' . $wgJsMimeType . '&smaxage=' . $wgSquidMaxage )
), ' ' );
$out->addScript( $script );
}
?>