Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1610,10 +1610,10 @@ |
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | $sk = $wgUser->getSkin(); |
1614 | | - |
| 1614 | + |
1615 | 1615 | // Add base resources |
1616 | 1616 | $this->addModules( array( 'mediawiki.legacy.wikibits' ) ); |
1617 | | - |
| 1617 | + |
1618 | 1618 | // Add various resources if required |
1619 | 1619 | if ( $wgUseAjax ) { |
1620 | 1620 | $this->addModules( 'mediawiki.legacy.ajax' ); |
— | — | @@ -2280,7 +2280,7 @@ |
2281 | 2281 | |
2282 | 2282 | return $ret; |
2283 | 2283 | } |
2284 | | - |
| 2284 | + |
2285 | 2285 | // TODO: Document |
2286 | 2286 | protected function makeResourceLoaderLink( $skin, $modules, $only, $useESI = false ) { |
2287 | 2287 | global $wgUser, $wgLang, $wgRequest, $wgLoadScript, $wgResourceLoaderDebug, $wgResourceLoaderUseESI, |
— | — | @@ -2350,7 +2350,7 @@ |
2351 | 2351 | } |
2352 | 2352 | // Make queries uniform in order |
2353 | 2353 | ksort( $query ); |
2354 | | - |
| 2354 | + |
2355 | 2355 | $url = wfAppendQuery( $wgLoadScript, $query ); |
2356 | 2356 | if ( $useESI && $wgResourceLoaderUseESI ) { |
2357 | 2357 | $esi = Xml::element( 'esi:include', array( 'src' => $url ) ); |
— | — | @@ -2370,7 +2370,7 @@ |
2371 | 2371 | } |
2372 | 2372 | return $links; |
2373 | 2373 | } |
2374 | | - |
| 2374 | + |
2375 | 2375 | /** |
2376 | 2376 | * Gets the global variables and mScripts; also adds userjs to the end if |
2377 | 2377 | * enabled. Despite the name, these scripts are no longer put in the |
— | — | @@ -2381,14 +2381,14 @@ |
2382 | 2382 | */ |
2383 | 2383 | function getHeadScripts( Skin $sk ) { |
2384 | 2384 | global $wgUser, $wgRequest, $wgUseSiteJs, $wgResourceLoaderDebug; |
2385 | | - |
| 2385 | + |
2386 | 2386 | // Startup - this will immediately load jquery and mediawiki modules |
2387 | 2387 | $scripts = $this->makeResourceLoaderLink( $sk, 'startup', 'scripts', true ); |
2388 | | - |
| 2388 | + |
2389 | 2389 | // Configuration -- This could be merged together with the load and go, but makeGlobalVariablesScript returns a |
2390 | 2390 | // whole script tag -- grumble grumble... |
2391 | 2391 | $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n"; |
2392 | | - |
| 2392 | + |
2393 | 2393 | // Script and Messages "only" |
2394 | 2394 | if ( $wgRequest->getFuzzyBool( 'debug', $wgResourceLoaderDebug ) ) { |
2395 | 2395 | // Scripts |
— | — | @@ -2409,7 +2409,7 @@ |
2410 | 2410 | $scripts .= $this->makeResourceLoaderLink( $sk, $this->getModuleMessages(), 'messages' ); |
2411 | 2411 | } |
2412 | 2412 | } |
2413 | | - |
| 2413 | + |
2414 | 2414 | // Modules - let the client calculate dependencies and batch requests as it likes |
2415 | 2415 | if ( $this->getModules() ) { |
2416 | 2416 | $modules = FormatJson::encode( $this->getModules() ); |
— | — | @@ -2417,7 +2417,7 @@ |
2418 | 2418 | "if ( window.mediaWiki ) { mediaWiki.loader.load( {$modules} ); mediaWiki.loader.go(); }" |
2419 | 2419 | ) . "\n"; |
2420 | 2420 | } |
2421 | | - |
| 2421 | + |
2422 | 2422 | // Add user JS if enabled - trying to load user.options as a bundle if possible |
2423 | 2423 | $userOptionsAdded = false; |
2424 | 2424 | if ( $this->isUserJsAllowed() && $wgUser->isLoggedIn() ) { |
— | — | @@ -2434,12 +2434,12 @@ |
2435 | 2435 | $scripts .= $this->makeResourceLoaderLink( $sk, 'user.options', 'scripts' ); |
2436 | 2436 | } |
2437 | 2437 | $scripts .= "\n" . $this->mScripts; |
2438 | | - |
| 2438 | + |
2439 | 2439 | // Add site JS if enabled |
2440 | 2440 | if ( $wgUseSiteJs ) { |
2441 | 2441 | $scripts .= $this->makeResourceLoaderLink( $sk, 'site', 'scripts' ); |
2442 | 2442 | } |
2443 | | - |
| 2443 | + |
2444 | 2444 | return $scripts; |
2445 | 2445 | } |
2446 | 2446 | |
— | — | @@ -2568,7 +2568,7 @@ |
2569 | 2569 | $tags[] = $this->makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles' ); |
2570 | 2570 | } |
2571 | 2571 | } |
2572 | | - |
| 2572 | + |
2573 | 2573 | return implode( "\n", $tags ); |
2574 | 2574 | } |
2575 | 2575 | |