From: Timo Tijhof Date: Wed, 6 Mar 2013 01:31:08 +0000 (+0100) Subject: Vector: Don't create an extra request for skins.vector module X-Git-Tag: 1.31.0-rc.0~20454^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=9af4bb672f581c77456918f7d6c060e34d4623f0;p=lhc%2Fweb%2Fwiklou.git Vector: Don't create an extra request for skins.vector module Blank MediaWiki page: head> load.php:startup load([ top ]) body> load.php:skins.vector&only=scripts load([ bottom ]) Skin styles are loaded outside ResourceLoader from the (so they don't wait for startup, and don't rely on javascript). Fair enough for basic page styling. Then the real `mw.loader`-able part of the module should be separated. There is no reason for it to also be loaded outside `mw.loader`. Change-Id: Ife69c5a443aac9eec8c2ec06d986b53b2379816f --- diff --git a/resources/Resources.php b/resources/Resources.php index 562c1768d4..d40e845363 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -26,7 +26,9 @@ if( !defined( 'MEDIAWIKI' ) ) { return array( - /* Special modules who have their own classes */ + /** + * Special modules who have their own classes + */ // Scripts managed by the local wiki (stored in the MediaWiki namespace) 'site' => array( 'class' => 'ResourceLoaderSiteModule' ), @@ -48,7 +50,16 @@ return array( // Scripts for the dynamic language specific data, like grammar forms. 'mediawiki.language.data' => array( 'class' => 'ResourceLoaderLanguageDataModule' ), - /* Skins */ + /** + * Skins + * Be careful not to add 'scripts' to these modules, + * since they are loaded with OutputPage::addModuleStyles so that the skin styles + * apply without javascript. + * If a skin needs custom js in the interface, register a separate module + * and add it to the load queue with OutputPage::addModules. + * + * See Vector for an example. + */ 'skins.chick' => array( 'styles' => array( 'chick/main.css' => array( 'media' => 'screen, handheld' ) ), @@ -102,6 +113,10 @@ return array( 'vector/screen.css' => array( 'media' => 'screen' ), 'vector/screen-hd.css' => array( 'media' => 'screen and (min-width: 982px)' ), ), + 'remoteBasePath' => $GLOBALS['wgStylePath'], + 'localBasePath' => $GLOBALS['wgStyleDirectory'], + ), + 'skins.vector.js' => array( 'scripts' => 'vector/vector.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], diff --git a/skins/Vector.php b/skins/Vector.php index 3e01d23b82..d0f9995159 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -57,7 +57,7 @@ class SkinVector extends SkinTemplate { "/{$this->stylename}/csshover{$min}.htc\")}" ); - $out->addModuleScripts( 'skins.vector' ); + $out->addModules( 'skins.vector.js' ); } /**