right on Apache too!
* Replace 'old-revision-navigation' message with 'revision-info' and
'revision-nav' messages, wrapped in divs with appropriate id's.
+* (bug 4178) MediaWiki:Common.js will now be included for all users if
+ $wgUseSiteJs is enabled, in addition to (if applicable) MediaWiki:Monobook.js
+ and user JS subpages.
== Languages updated ==
$r = self::makeGlobalVariablesScript( $vars );
$r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
+ global $wgUseSiteJs;
+ if ($wgUseSiteJs) {
+ if ($wgUser->isLoggedIn()) {
+ $r .= "<script type=\"$wgJsMimeType\" src=\"".urlencode(self::makeUrl('-','action=raw&smaxage=0&gen=js'))."\"><!-- site js --></script>\n";
+ } else {
+ $r .= "<script type=\"$wgJsMimeType\" src=\"".urlencode(self::makeUrl('-','action=raw&gen=js'))."\"><!-- site js --></script>\n";
+ }
+ }
if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
$userjs = htmlspecialchars( self::makeUrl(
}
/**
- * placeholder, returns generated js in monobook
+ * This returns MediaWiki:Common.js. For some bizarre reason, it does
+ * *not* return any custom user JS from user subpages. Huh?
+ *
+ * @return string
*/
- function getUserJs() { return; }
+ function getUserJs() {
+ $fname = 'Skin::getUserJs';
+ wfProfileIn( $fname );
+
+ global $wgStylePath;
+ $s = "/* generated javascript */\n";
+ $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
+ $s .= "\n\n/* MediaWiki:Common.js */\n";
+ $commonJs = wfMsgForContent('Common.js');
+ if ( !wfEmptyMsg ( 'Common.js', $commonJs ) ) {
+ $s .= $commonJs;
+ }
+
+ wfProfileOut( $fname );
+ return $s;
+ }
/**
* Return html code that include User stylesheets
}
/**
- * @public
+ * This returns MediaWiki:Common.js and MediaWiki:[Skinname].js concate-
+ * nated together. For some bizarre reason, it does *not* return any
+ * custom user JS from subpages. Huh?
+ *
+ * There's absolutely no reason to have separate Monobook/Common JSes.
+ * Any JS that cares can just check the skin variable generated at the
+ * top. For now Monobook.js will be maintained, but it should be consi-
+ * dered deprecated.
+ *
+ * @return string
*/
- function getUserJs() {
+ public function getUserJs() {
$fname = 'SkinTemplate::getUserJs';
wfProfileIn( $fname );
- global $wgStylePath;
- $s = '/* generated javascript */';
- $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
- $s .= '/* MediaWiki:'.ucfirst($this->skinname)." */\n";
+ $s = parent::getUserJs();
+ $s .= "\n\n/* MediaWiki:".ucfirst($this->skinname).".js (deprecated; migrate to Common.js!) */\n";
// avoid inclusion of non defined user JavaScript (with custom skins only)
// by checking for default message content
ta[\'ca-nstab-help\'] = new Array(\'c\',\'View the help page\');
ta[\'ca-nstab-category\'] = new Array(\'c\',\'View the category page\');',
+# Common.js: contains nothing but a placeholder comment
+'Common.js' => '/* Any JavaScript here will be loaded for all users on every page load. */',
+
# image deletion
'deletedrevision' => 'Deleted old revision $1.',