Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3047
skinstandard.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:20 PM
2014-11-21 21:20:40 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
skinstandard.diff
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2617
Default Alt Text
skinstandard.diff (1 KB)
Attached To
Mode
T8377: Request for a supplementary javascript for non-Monobook skins
Attached
Detach File
Event Timeline
Log In to Comment