Jump to content

User:Dto/CommonJSext

From Wikipedia, the free encyclopedia

<?php if(!defined('MEDIAWIKI'))

  die();

$wgExtensionFunctions[] = 'addCommonJSscript'; $wgExtensionCredits['other'][] = array(

  'name' => 'Common.js',
  'author' => 'Dan Li',
  'description' => 'includes MediaWiki:Common.js in pages'

);

function addCommonJSscript() {

  global $wgOut, $wgJsMimeType, $wgSquidMaxage;
  $t = Title::makeTitle(NS_MEDIAWIKI, 'Common.js');
  $wgOut->addScript('<script type="text/javascript" src="' . $t->escapeLocalURL("action=raw&ctype={$wgJsMimeType}&smaxage=$wgSquidMaxage") . '"></script>');

} ?>