From a51a6cca91ff80be2909122a22998bae0011e12b Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Fri, 10 Sep 2010 20:42:44 +0000 Subject: [PATCH] Moved mediaWiki.loader.go() up to be above scripts that are not wrapped, and need access to stuff being loaded by go(). --- includes/OutputPage.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 67810d0f60..e502f1ba0c 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2312,8 +2312,10 @@ class OutputPage { // Statup - this will immediately load jquery and mediawiki modules $scripts = self::makeResourceLoaderLink( $sk, 'startup', 'scripts' ); + // Configuration $scripts .= Skin::makeGlobalVariablesScript( $sk->getSkinName() ) . "\n"; + // Support individual script requests in debug mode if ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) !== 'false' ) { // Scripts @@ -2341,6 +2343,10 @@ class OutputPage { "if ( mediaWiki !== undefined ) { mediaWiki.loader.load( {$modules} ); }" ); } + + // Add code to fetch all requested modules + $scripts .= Html::inlineScript( "if ( mediaWiki !== undefined ) { mediaWiki.loader.go(); }" ); + // TODO: User Scripts should be included using the resource loader // Add user JS if enabled if( $this->isUserJsAllowed() && $wgUser->isLoggedIn() ) { @@ -2360,8 +2366,7 @@ class OutputPage { } } $scripts .= "\n" . $this->mScripts; - // This should be at the bottom of the body - below ALL other scripts - $scripts .= Html::inlineScript( "if ( mediaWiki !== undefined ) { mediaWiki.loader.go(); }" ); + // Add site JS if enabled if ( $wgUseSiteJs ) { $scripts .= self::makeResourceLoaderLink( $sk, 'sitejs', 'scripts' ); -- 2.20.1