Index: trunk/phase3/includes/debug/Debug.php |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | */ |
64 | 64 | public static function addModules( OutputPage $out ) { |
65 | 65 | if ( self::$enabled ) { |
66 | | - $out->addModules( 'mediawiki.debug' ); |
| 66 | + $out->addModules( 'mediawiki.debug.init' ); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
— | — | @@ -272,12 +272,15 @@ |
273 | 273 | 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ), |
274 | 274 | 'includes' => self::getFilesIncluded( $context ), |
275 | 275 | ); |
276 | | - // TODO: Clean this up |
277 | | - $html = Html::openElement( 'script' ); |
278 | | - $html .= 'var debugInfo = ' . Xml::encodeJsVar( $debugInfo ) . ';'; |
279 | | - $html .= " $(function() { mw.loader.using( 'mediawiki.debug', function() { mw.Debug.init( debugInfo ) } ); }); "; |
280 | | - $html .= Html::closeElement( 'script' ); |
281 | 276 | |
| 277 | + // Cannot use OutputPage::addJsConfigVars because those are already outputted |
| 278 | + // by the time this method is called. |
| 279 | + $html = Html::inlineScript( |
| 280 | + ResourceLoader::makeLoaderConditionalScript( |
| 281 | + ResourceLoader::makeConfigSetScript( array( 'debugInfo' => $debugInfo ) ) |
| 282 | + ) |
| 283 | + ); |
| 284 | + |
282 | 285 | return $html; |
283 | 286 | } |
284 | 287 | } |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -543,7 +543,15 @@ |
544 | 544 | 'scripts' => 'resources/mediawiki/mediawiki.debug.js', |
545 | 545 | 'styles' => 'resources/mediawiki/mediawiki.debug.css', |
546 | 546 | 'dependencies' => 'jquery.footHovzer', |
| 547 | + 'position' => 'bottom', |
547 | 548 | ), |
| 549 | + 'mediawiki.debug.init' => array( |
| 550 | + 'scripts' => 'resources/mediawiki/mediawiki.debug.init.js', |
| 551 | + 'dependencies' => 'mediawiki.debug', |
| 552 | + // Uses a custom mw.config variable that is set in debughtml, |
| 553 | + // must be loaded on the bottom |
| 554 | + 'position' => 'bottom', |
| 555 | + ), |
548 | 556 | 'mediawiki.feedback' => array( |
549 | 557 | 'scripts' => 'resources/mediawiki/mediawiki.feedback.js', |
550 | 558 | 'dependencies' => array( |
Index: trunk/phase3/resources/mediawiki/mediawiki.debug.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * JavaScript for the new debug toolbar, enabled with $wgDebugToolbar |
| 3 | + * JavaScript for the new debug toolbar, enabled through $wgDebugToolbar. |
4 | 4 | * |
5 | 5 | * @author John Du Hart |
6 | 6 | * @since 1.19 |
— | — | @@ -26,13 +26,15 @@ |
27 | 27 | data: {}, |
28 | 28 | |
29 | 29 | /** |
30 | | - * Initializes the debugging pane |
| 30 | + * Initializes the debugging pane. |
| 31 | + * Shouldn't be called before the document is ready |
| 32 | + * (since it binds to elements on the page). |
31 | 33 | * |
32 | | - * @param {Object} data |
| 34 | + * @param {Object} data, defaults to 'debugInfo' from mw.config |
33 | 35 | */ |
34 | 36 | init: function ( data ) { |
35 | 37 | |
36 | | - this.data = data; |
| 38 | + this.data = data || mw.config.get( 'debugInfo' ); |
37 | 39 | this.buildHtml(); |
38 | 40 | |
39 | 41 | // Insert the container into the DOM |
Index: trunk/phase3/resources/mediawiki/mediawiki.debug.init.js |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +jQuery( function () { |
| 3 | + mediaWiki.Debug.init(); |
| 4 | +} ); |
Property changes on: trunk/phase3/resources/mediawiki/mediawiki.debug.init.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |