Page MenuHomePhabricator

skinstandard.diff

Authored By
bzimport
Nov 21 2014, 9:20 PM
Size
1 KB
Referenced Files
None
Subscribers
None

skinstandard.diff

Index: skins/Standard.php
===================================================================
--- skins/Standard.php (revision 16128)
+++ skins/Standard.php (working copy)
@@ -21,9 +21,21 @@
*
*/
function getHeadScripts() {
- global $wgStylePath, $wgJsMimeType;
+ global $wgStylePath, $wgJsMimeType, $wgUseSiteJs;
$s = parent::getHeadScripts();
+
+ // allow inclusion of MediaWiki:Standard.js, adapted from SkinTemplate::outputPage
+ if ($wgUseSiteJs) {
+ global $wgUser;
+ if($wgUser->isLoggedIn()) {
+ $sitejs = $this->makeUrl('-','action=raw&smaxage=0&gen=js');
+ } else {
+ $sitejs = $this->makeUrl('-','action=raw&gen=js');
+ }
+ $s .= "<script language='javascript' type='$wgJsMimeType' src='$sitejs'></script>\n";
+ }
+
if ( 3 == $this->qbSetting() ) { # Floating left
$s .= "<script language='javascript' type='$wgJsMimeType' " .
"src='{$wgStylePath}/common/sticky.js'></script>\n";
@@ -73,6 +85,30 @@
}
/**
+ * Adapted from SkinTemplate::getUserJs. Too bad SkinStandard doesn't extend SkinTemplate.
+ * @see RawPage
+ */
+ function getUserJs() {
+ $fname = 'SkinStandard::getUserJs';
+ wfProfileIn( $fname );
+
+ global $wgStylePath;
+ $s = '/* generated javascript */';
+ $s .= "var skin = 'standard';\nvar stylepath = '{$wgStylePath}';";
+ $s .= "/* MediaWiki:Standard */\n";
+
+ // avoid inclusion of non defined user JavaScript (with custom skins only)
+ $msgKey = 'Standard.js';
+ $userJS = wfMsg($msgKey);
+ if (!wfEmptyMsg($msgKey, $userJS)) {
+ $s .= $userJS;
+ }
+
+ wfProfileOut( $fname );
+ return $s;
+ }
+
+ /**
*
*/
function getBodyOptions() {

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2617
Default Alt Text
skinstandard.diff (1 KB)

Event Timeline