Index: branches/resourceloader/phase3/includes/ResourceLoader.php |
— | — | @@ -117,14 +117,14 @@ |
118 | 118 | * |
119 | 119 | * @return {string} JavaScript code for registereing all modules with client loader |
120 | 120 | */ |
121 | | - protected static function getModuleRegistrations() { |
| 121 | + public static function getModuleRegistrations() { |
122 | 122 | $scripts = ''; |
123 | 123 | $registrations = array(); |
124 | 124 | foreach ( self::$modules as $name => $module ) { |
125 | 125 | if ( !in_array( $name, self::$preRegisteredModules ) ) { |
126 | 126 | // Support module loader scripts |
127 | | - if ( $loader = $module->getLoaderScript() !== false ) { |
128 | | - $scripts .= $loader; |
| 127 | + if ( ( $loader = $module->getLoaderScript() ) !== false ) { |
| 128 | + $scripts .= "\n" . $loader; |
129 | 129 | } |
130 | 130 | // Automatically register module |
131 | 131 | else { |
— | — | @@ -139,7 +139,8 @@ |
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
143 | | - return $scripts . "\nmediaWiki.loader.register( " . FormatJSON::encode( $registrations ) . " );\n"; |
| 143 | + $scripts .= "\nmediaWiki.loader.register( " . FormatJson::encode( $registrations ) . " );\n"; |
| 144 | + return "window.mediaWikiStartUp = function() {" . $scripts . "};"; |
144 | 145 | } |
145 | 146 | |
146 | 147 | /* Static Methods */ |
Index: branches/resourceloader/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -543,3 +543,20 @@ |
544 | 544 | public function getLoaderScript() { return ''; } |
545 | 545 | public function getDependencies() { return array(); } |
546 | 546 | } |
| 547 | + |
| 548 | + |
| 549 | +class ResourceLoaderStartupModule extends ResourceLoaderModule { |
| 550 | + public function getScript( $lang, $skin, $debug ) { |
| 551 | + return ResourceLoader::getModuleRegistrations(); |
| 552 | + } |
| 553 | + |
| 554 | + public function getModifiedTime( $lang, $skin, $debug ) { |
| 555 | + // FIXME |
| 556 | + return wfTimestamp(); |
| 557 | + } |
| 558 | + |
| 559 | + public function getStyle( $skin ) { return ''; } |
| 560 | + public function getMessages() { return array(); } |
| 561 | + public function getLoaderScript() { return ''; } |
| 562 | + public function getDependencies() { return array(); } |
| 563 | +} |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/Resources.php |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | /* Special resources who have their own classes */ |
7 | 7 | |
8 | 8 | 'sitejs' => new ResourceLoaderSiteJSModule, |
| 9 | + 'startup' => new ResourceLoaderStartupModule, |
9 | 10 | |
10 | 11 | /* Skins */ |
11 | 12 | |