r72138 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72137‎ | r72138 | r72139 >
Date:18:21, 1 September 2010
Author:tparscal
Status:ok
Tags:
Comment:
Finally, the order is set. Startup loads jquery and mediawiki, raw JS, CSS and messages are added, finally a mediaWiki.loader.load call is made and modules are downloaded with dependencies resolved.
Modified paths:
  • /branches/resourceloader/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: branches/resourceloader/phase3/includes/OutputPage.php
@@ -2312,19 +2312,12 @@
23132313 global $wgUser, $wgRequest, $wgJsMimeType;
23142314 global $wgStylePath, $wgStyleVersion;
23152315
 2316+ // Statup - this will immediately load jquery and mediawiki modules
23162317 $scripts = self::makeResourceLoaderLink( $sk, 'startup', 'scripts' );
 2318+ // Configuration
 2319+ $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n";
23172320 // Support individual script requests in debug mode
23182321 if ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) !== 'false' ) {
2319 - // Configuration
2320 - $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n";
2321 - // Messages
2322 - foreach ( $this->getModuleMessages() as $name ) {
2323 - $scripts .= self::makeResourceLoaderLink( $sk, $name, 'messages' );
2324 - }
2325 - // Modules
2326 - foreach ( $this->getModules() as $name ) {
2327 - $scripts .= self::makeResourceLoaderLink( $sk, $name );
2328 - }
23292322 // Styles
23302323 foreach ( $this->getModuleStyles() as $name ) {
23312324 $scripts .= self::makeResourceLoaderLink( $sk, $name, 'styles' );
@@ -2333,17 +2326,11 @@
23342327 foreach ( $this->getModuleScripts() as $name ) {
23352328 $scripts .= self::makeResourceLoaderLink( $sk, $name, 'scripts' );
23362329 }
2337 - } else {
2338 - // Configuration
2339 - $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n";
23402330 // Messages
2341 - if ( count( $this->getModuleMessages() ) ) {
2342 - $scripts .= self::makeResourceLoaderLink( $sk, $this->getModuleMessages(), 'messages' );
 2331+ foreach ( $this->getModuleMessages() as $name ) {
 2332+ $scripts .= self::makeResourceLoaderLink( $sk, $name, 'messages' );
23432333 }
2344 - // Modules
2345 - if ( count( $this->getModules() ) ) {
2346 - $scripts .= self::makeResourceLoaderLink( $sk, $this->getModules() );
2347 - }
 2334+ } else {
23482335 // Styles
23492336 if ( count( $this->getModuleStyles() ) ) {
23502337 $scripts .= self::makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles' );
@@ -2352,7 +2339,17 @@
23532340 if ( count( $this->getModuleScripts() ) ) {
23542341 $scripts .= self::makeResourceLoaderLink( $sk, $this->getModuleScripts(), 'scripts' );
23552342 }
 2343+ // Messages
 2344+ if ( count( $this->getModuleMessages() ) ) {
 2345+ $scripts .= self::makeResourceLoaderLink( $sk, $this->getModuleMessages(), 'messages' );
 2346+ }
23562347 }
 2348+ if ( $this->getModules() ) {
 2349+ // Modules - let the client calculate dependencies and batch requests as it likes
 2350+ $scripts .= Html::inlineScript(
 2351+ 'mediaWiki.loader.load( ' . FormatJson::encode( $this->getModules() ) . ' )'
 2352+ );
 2353+ }
23572354 // add user JS if enabled
23582355 if( $this->isUserJsAllowed() && $wgUser->isLoggedIn() ) {
23592356 $action = $wgRequest->getVal( 'action', 'view' );

Status & tagging log