Index: branches/resourceloader/phase3/includes/ResourceLoader.php |
— | — | @@ -113,6 +113,7 @@ |
114 | 114 | * 'locales' => [array: paths to scripts to include, keyed by locale name, optional], |
115 | 115 | * 'messages' => [array: message keys, optional], |
116 | 116 | * 'loader' => [string: path to file, optional], |
| 117 | + * 'needs' => [array: names of modules this module needs, optional - ignored if loader is present], |
117 | 118 | * 'raw' => [boolean: include directly without any loading support, optional], |
118 | 119 | * 'debug' => [boolean: include in debug mode only, optional], |
119 | 120 | * ) |
— | — | @@ -144,6 +145,7 @@ |
145 | 146 | 'locales' => array(), |
146 | 147 | 'messages' => array(), |
147 | 148 | 'loader' => null, |
| 149 | + 'needs' => array(), |
148 | 150 | 'raw' => false, |
149 | 151 | 'debug' => false, |
150 | 152 | ), $options ); |
— | — | @@ -215,9 +217,11 @@ |
216 | 218 | // Use output buffering |
217 | 219 | ob_start(); |
218 | 220 | // Output raw modules first |
| 221 | + $ready = array(); |
219 | 222 | foreach ( $modules as $module ) { |
220 | 223 | if ( self::$modules[$module]['raw'] ) { |
221 | 224 | readfile( self::$modules[$module]['script'] ); |
| 225 | + $ready[] = $module; |
222 | 226 | echo "\n"; |
223 | 227 | } |
224 | 228 | } |
— | — | @@ -235,12 +239,19 @@ |
236 | 240 | echo "mw.config.set( " . json_encode( $parameters ) . " );\n"; |
237 | 241 | // Collect all loaders |
238 | 242 | $loaders = array(); |
239 | | - $registers = array(); |
| 243 | + $registrations = array(); |
240 | 244 | foreach ( self::$modules as $name => $options ) { |
241 | 245 | if ( $options['loader'] !== null ) { |
242 | 246 | $loaders[] = $options['loader']; |
243 | 247 | } else { |
244 | | - $registers[] = $name; |
| 248 | + if ( empty( $options['needs'] ) && !in_array( $name, $ready ) ) { |
| 249 | + $registrations[$name] = $name; |
| 250 | + } else { |
| 251 | + $registrations[$name] = array( $name, $options['needs'] ); |
| 252 | + if ( in_array( $name, $ready ) ) { |
| 253 | + $registrations[$name][] = 'ready'; |
| 254 | + } |
| 255 | + } |
245 | 256 | } |
246 | 257 | } |
247 | 258 | // Include loaders |
— | — | @@ -249,7 +260,7 @@ |
250 | 261 | echo "\n"; |
251 | 262 | } |
252 | 263 | // Register modules without loaders |
253 | | - echo "mw.loader.register( " . json_encode( array_unique( $registers ) ) . " );\n"; |
| 264 | + echo "mw.loader.register( " . json_encode( array_values( $registrations ) ) . " );\n"; |
254 | 265 | } |
255 | 266 | // Output non-raw modules |
256 | 267 | $blobs = MessageBlobStore::get( $modules, $parameters['lang'] ); |
Index: branches/resourceloader/phase3/resources/test/loader.js |
— | — | @@ -1,6 +0,0 @@ |
2 | | -// Registers the modules with the loading system |
3 | | -mw.loader.register( 'test', ['foo'] ); |
4 | | -mw.loader.register( 'foo', ['bar'] ); |
5 | | -mw.loader.register( 'bar', ['buz'] ); |
6 | | -mw.loader.register( 'buz', ['baz'] ); |
7 | | -mw.loader.register( 'baz', [] ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/test/index.html |
— | — | @@ -8,18 +8,9 @@ |
9 | 9 | color: white; |
10 | 10 | } |
11 | 11 | </style> |
12 | | - <script type="text/javascript" src="../../load.php?modules=jquery|mediawiki&debug=1&skin=vector&lang=ja"></script> |
| 12 | + <script type="text/javascript" src="../../load.php?modules=jquery|mediawiki&debug=false&skin=vector&lang=ja"></script> |
13 | 13 | <script type="text/javascript"> |
14 | 14 | mw.config.set( 'wgScriptPath', '../..' ); |
15 | | - $(document).ready( function() { |
16 | | - mw.loader.using( ['jquery.ui.core', 'jquery.ui.datepicker'], function() { |
17 | | - $( '#datepicker' ).datepicker(); |
18 | | - mw.log( 'datepicker (dynamic)' ); |
19 | | - } ); |
20 | | - mw.loader.using( 'test', function() { |
21 | | - mw.log( 'test (static with dynamic needs)' ); |
22 | | - } ); |
23 | | - } ); |
24 | 15 | </script> |
25 | 16 | </head> |
26 | 17 | <body> |
— | — | @@ -31,6 +22,17 @@ |
32 | 23 | <strong>Datepicker....</strong> |
33 | 24 | <div id="datepicker"></div> |
34 | 25 | </p> |
35 | | - <script type="text/javascript" src="../../load.php?modules=test&debug=1&skin=vector&lang=ja"></script> |
| 26 | + <script type="text/javascript" > |
| 27 | + mw.loader.load( ['test', 'jquery.ui.core', 'jquery.ui.datepicker'] ); |
| 28 | + </script> |
| 29 | + <script type="text/javascript"> |
| 30 | + mw.loader.using( 'test', function() { |
| 31 | + mw.log( 'test (static with dynamic needs)' ); |
| 32 | + } ); |
| 33 | + mw.loader.using( 'jquery.ui.datepicker', function() { |
| 34 | + $( '#datepicker' ).datepicker(); |
| 35 | + mw.log( 'datepicker (dynamic)' ); |
| 36 | + } ); |
| 37 | + </script> |
36 | 38 | </body> |
37 | 39 | </html> |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/Resources.php |
— | — | @@ -14,9 +14,6 @@ |
15 | 15 | /* jQuery UI */ |
16 | 16 | |
17 | 17 | // Components |
18 | | - 'jquery.ui.accordion' => array( 'script' => 'resources/jquery/ui/jquery.ui.accordion.js' ), |
19 | | - 'jquery.ui.autocomplete' => array( 'script' => 'resources/jquery/ui/jquery.ui.autocomplete.js' ), |
20 | | - 'jquery.ui.button' => array( 'script' => 'resources/jquery/ui/jquery.ui.button.js' ), |
21 | 18 | 'jquery.ui.core' => array( |
22 | 19 | 'script' => 'resources/jquery/ui/jquery.ui.core.js', |
23 | 20 | 'style' => 'resources/jquery/ui/themes/base/jquery.ui.theme.css', |
— | — | @@ -25,9 +22,23 @@ |
26 | 23 | 'vector' => 'resources/jquery/ui/themes/vector/jquery.ui.theme.css', |
27 | 24 | 'monobook' => 'resources/jquery/ui/themes/monobook/jquery.ui.theme.css', |
28 | 25 | ), |
| 26 | + 'needs' => array( 'jquery' ), |
29 | 27 | ), |
| 28 | + 'jquery.ui.accordion' => array( |
| 29 | + 'script' => 'resources/jquery/ui/jquery.ui.accordion.js', |
| 30 | + 'needs' => array( 'jquery.ui.core' ), |
| 31 | + ), |
| 32 | + 'jquery.ui.autocomplete' => array( |
| 33 | + 'script' => 'resources/jquery/ui/jquery.ui.autocomplete.js', |
| 34 | + 'needs' => array( 'jquery.ui.core' ), |
| 35 | + ), |
| 36 | + 'jquery.ui.button' => array( |
| 37 | + 'script' => 'resources/jquery/ui/jquery.ui.button.js', |
| 38 | + 'needs' => array( 'jquery.ui.core' ), |
| 39 | + ), |
30 | 40 | 'jquery.ui.datepicker' => array( |
31 | 41 | 'script' => 'resources/jquery/ui/jquery.ui.datepicker.js', |
| 42 | + 'needs' => array( 'jquery.ui.core' ), |
32 | 43 | 'style' => 'resources/jquery/ui/themes/base/jquery.ui.datepicker.css', |
33 | 44 | 'themes' => array( |
34 | 45 | 'default' => 'resources/jquery/ui/themes/default/jquery.ui.datepicker.css', |
— | — | @@ -89,147 +100,438 @@ |
90 | 101 | 'zh-tw' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-TW.js' |
91 | 102 | ), |
92 | 103 | ), |
93 | | - 'jquery.ui.dialog' => array( 'script' => 'resources/jquery/ui/jquery.ui.dialog.js' ), |
94 | | - 'jquery.ui.draggable' => array( 'script' => 'resources/jquery/ui/jquery.ui.draggable.js' ), |
95 | | - 'jquery.ui.droppable' => array( 'script' => 'resources/jquery/ui/jquery.ui.droppable.js' ), |
96 | | - 'jquery.ui.mouse' => array( 'script' => 'resources/jquery/ui/jquery.ui.mouse.js' ), |
97 | | - 'jquery.ui.position' => array( 'script' => 'resources/jquery/ui/jquery.ui.position.js' ), |
98 | | - 'jquery.ui.progressbar' => array( 'script' => 'resources/jquery/ui/jquery.ui.progressbar.js' ), |
99 | | - 'jquery.ui.resizable' => array( 'script' => 'resources/jquery/ui/jquery.ui.resizable.js' ), |
100 | | - 'jquery.ui.selectable' => array( 'script' => 'resources/jquery/ui/jquery.ui.selectable.js' ), |
101 | | - 'jquery.ui.slider' => array( 'script' => 'resources/jquery/ui/jquery.ui.slider.js' ), |
102 | | - 'jquery.ui.sortable' => array( 'script' => 'resources/jquery/ui/jquery.ui.sortable.js' ), |
103 | | - 'jquery.ui.tabs' => array( 'script' => 'resources/jquery/ui/jquery.ui.tabs.js' ), |
104 | | - 'jquery.ui.widget' => array( 'script' => 'resources/jquery/ui/jquery.ui.widget.js' ), |
| 104 | + 'jquery.ui.dialog' => array( |
| 105 | + 'script' => 'resources/jquery/ui/jquery.ui.dialog.js', |
| 106 | + 'needs' => array( 'jquery.ui.core' ), |
| 107 | + ), |
| 108 | + 'jquery.ui.draggable' => array( |
| 109 | + 'script' => 'resources/jquery/ui/jquery.ui.draggable.js', |
| 110 | + 'needs' => array( 'jquery.ui.core' ), |
| 111 | + ), |
| 112 | + 'jquery.ui.droppable' => array( |
| 113 | + 'script' => 'resources/jquery/ui/jquery.ui.droppable.js', |
| 114 | + 'needs' => array( 'jquery.ui.core' ), |
| 115 | + ), |
| 116 | + 'jquery.ui.mouse' => array( |
| 117 | + 'script' => 'resources/jquery/ui/jquery.ui.mouse.js', |
| 118 | + 'needs' => array( 'jquery.ui.core' ), |
| 119 | + ), |
| 120 | + 'jquery.ui.position' => array( |
| 121 | + 'script' => 'resources/jquery/ui/jquery.ui.position.js', |
| 122 | + 'needs' => array( 'jquery.ui.core' ), |
| 123 | + ), |
| 124 | + 'jquery.ui.progressbar' => array( |
| 125 | + 'script' => 'resources/jquery/ui/jquery.ui.progressbar.js', |
| 126 | + 'needs' => array( 'jquery.ui.core' ), |
| 127 | + ), |
| 128 | + 'jquery.ui.resizable' => array( |
| 129 | + 'script' => 'resources/jquery/ui/jquery.ui.resizable.js', |
| 130 | + 'needs' => array( 'jquery.ui.core' ), |
| 131 | + ), |
| 132 | + 'jquery.ui.selectable' => array( |
| 133 | + 'script' => 'resources/jquery/ui/jquery.ui.selectable.js', |
| 134 | + 'needs' => array( 'jquery.ui.core' ), |
| 135 | + ), |
| 136 | + 'jquery.ui.slider' => array( |
| 137 | + 'script' => 'resources/jquery/ui/jquery.ui.slider.js', |
| 138 | + 'needs' => array( 'jquery.ui.core' ), |
| 139 | + ), |
| 140 | + 'jquery.ui.sortable' => array( |
| 141 | + 'script' => 'resources/jquery/ui/jquery.ui.sortable.js', |
| 142 | + 'needs' => array( 'jquery.ui.core' ), |
| 143 | + ), |
| 144 | + 'jquery.ui.tabs' => array( |
| 145 | + 'script' => 'resources/jquery/ui/jquery.ui.tabs.js', |
| 146 | + 'needs' => array( 'jquery.ui.core' ), |
| 147 | + ), |
| 148 | + 'jquery.ui.widget' => array( |
| 149 | + 'script' => 'resources/jquery/ui/jquery.ui.widget.js', |
| 150 | + 'needs' => array( 'jquery.ui.core' ), |
| 151 | + ), |
105 | 152 | // i18n |
106 | | - 'jquery.ui.datepicker-af' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-af.js' ), |
107 | | - 'jquery.ui.datepicker-ar' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ar.js' ), |
108 | | - 'jquery.ui.datepicker-az' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-az.js' ), |
109 | | - 'jquery.ui.datepicker-bg' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-bg.js' ), |
110 | | - 'jquery.ui.datepicker-bs' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-bs.js' ), |
111 | | - 'jquery.ui.datepicker-ca' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ca.js' ), |
112 | | - 'jquery.ui.datepicker-cs' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-cs.js' ), |
113 | | - 'jquery.ui.datepicker-da' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-da.js' ), |
114 | | - 'jquery.ui.datepicker-de' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-de.js' ), |
115 | | - 'jquery.ui.datepicker-el' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-el.js' ), |
116 | | - 'jquery.ui.datepicker-en-GB' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-en-GB.js' ), |
117 | | - 'jquery.ui.datepicker-eo' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-eo.js' ), |
118 | | - 'jquery.ui.datepicker-es' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-es.js' ), |
119 | | - 'jquery.ui.datepicker-et' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-et.js' ), |
120 | | - 'jquery.ui.datepicker-eu' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-eu.js' ), |
121 | | - 'jquery.ui.datepicker-fa' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fa.js' ), |
122 | | - 'jquery.ui.datepicker-fi' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fi.js' ), |
123 | | - 'jquery.ui.datepicker-fo' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fo.js' ), |
124 | | - 'jquery.ui.datepicker-fr-CH' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fr-CH.js' ), |
125 | | - 'jquery.ui.datepicker-fr' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fr.js' ), |
126 | | - 'jquery.ui.datepicker-he' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-he.js' ), |
127 | | - 'jquery.ui.datepicker-hr' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hr.js' ), |
128 | | - 'jquery.ui.datepicker-hu' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hu.js' ), |
129 | | - 'jquery.ui.datepicker-hy' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hy.js' ), |
130 | | - 'jquery.ui.datepicker-id' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-id.js' ), |
131 | | - 'jquery.ui.datepicker-is' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-is.js' ), |
132 | | - 'jquery.ui.datepicker-it' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-it.js' ), |
133 | | - 'jquery.ui.datepicker-ja' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ja.js' ), |
134 | | - 'jquery.ui.datepicker-ko' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ko.js' ), |
135 | | - 'jquery.ui.datepicker-lt' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-lt.js' ), |
136 | | - 'jquery.ui.datepicker-lv' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-lv.js' ), |
137 | | - 'jquery.ui.datepicker-ms' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ms.js' ), |
138 | | - 'jquery.ui.datepicker-nl' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-nl.js' ), |
139 | | - 'jquery.ui.datepicker-no' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-no.js' ), |
140 | | - 'jquery.ui.datepicker-pl' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-pl.js' ), |
141 | | - 'jquery.ui.datepicker-pt-BR' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-pt-BR.js' ), |
142 | | - 'jquery.ui.datepicker-ro' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ro.js' ), |
143 | | - 'jquery.ui.datepicker-ru' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ru.js' ), |
144 | | - 'jquery.ui.datepicker-sk' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sk.js' ), |
145 | | - 'jquery.ui.datepicker-sl' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sl.js' ), |
146 | | - 'jquery.ui.datepicker-sq' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sq.js' ), |
147 | | - 'jquery.ui.datepicker-sr-SR' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sr-SR.js' ), |
148 | | - 'jquery.ui.datepicker-sr' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sr.js' ), |
149 | | - 'jquery.ui.datepicker-sv' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sv.js' ), |
150 | | - 'jquery.ui.datepicker-ta' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ta.js' ), |
151 | | - 'jquery.ui.datepicker-th' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-th.js' ), |
152 | | - 'jquery.ui.datepicker-tr' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-tr.js' ), |
153 | | - 'jquery.ui.datepicker-uk' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-uk.js' ), |
154 | | - 'jquery.ui.datepicker-vi' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-vi.js' ), |
155 | | - 'jquery.ui.datepicker-zh-CN' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-CN.js' ), |
156 | | - 'jquery.ui.datepicker-zh-HK' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-HK.js' ), |
157 | | - 'jquery.ui.datepicker-zh-TW' => array( 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-TW.js' ), |
| 153 | + 'jquery.ui.datepicker-af' => array( |
| 154 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-af.js', |
| 155 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 156 | + ), |
| 157 | + 'jquery.ui.datepicker-ar' => array( |
| 158 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ar.js', |
| 159 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 160 | + ), |
| 161 | + 'jquery.ui.datepicker-az' => array( |
| 162 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-az.js', |
| 163 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 164 | + ), |
| 165 | + 'jquery.ui.datepicker-bg' => array( |
| 166 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-bg.js', |
| 167 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 168 | + ), |
| 169 | + 'jquery.ui.datepicker-bs' => array( |
| 170 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-bs.js', |
| 171 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 172 | + ), |
| 173 | + 'jquery.ui.datepicker-ca' => array( |
| 174 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ca.js', |
| 175 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 176 | + ), |
| 177 | + 'jquery.ui.datepicker-cs' => array( |
| 178 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-cs.js', |
| 179 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 180 | + ), |
| 181 | + 'jquery.ui.datepicker-da' => array( |
| 182 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-da.js', |
| 183 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 184 | + ), |
| 185 | + 'jquery.ui.datepicker-de' => array( |
| 186 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-de.js', |
| 187 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 188 | + ), |
| 189 | + 'jquery.ui.datepicker-el' => array( |
| 190 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-el.js', |
| 191 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 192 | + ), |
| 193 | + 'jquery.ui.datepicker-en-GB' => array( |
| 194 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-en-GB.js', |
| 195 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 196 | + ), |
| 197 | + 'jquery.ui.datepicker-eo' => array( |
| 198 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-eo.js', |
| 199 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 200 | + ), |
| 201 | + 'jquery.ui.datepicker-es' => array( |
| 202 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-es.js', |
| 203 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 204 | + ), |
| 205 | + 'jquery.ui.datepicker-et' => array( |
| 206 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-et.js', |
| 207 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 208 | + ), |
| 209 | + 'jquery.ui.datepicker-eu' => array( |
| 210 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-eu.js', |
| 211 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 212 | + ), |
| 213 | + 'jquery.ui.datepicker-fa' => array( |
| 214 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fa.js', |
| 215 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 216 | + ), |
| 217 | + 'jquery.ui.datepicker-fi' => array( |
| 218 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fi.js', |
| 219 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 220 | + ), |
| 221 | + 'jquery.ui.datepicker-fo' => array( |
| 222 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fo.js', |
| 223 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 224 | + ), |
| 225 | + 'jquery.ui.datepicker-fr-CH' => array( |
| 226 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fr-CH.js', |
| 227 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 228 | + ), |
| 229 | + 'jquery.ui.datepicker-fr' => array( |
| 230 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-fr.js', |
| 231 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 232 | + ), |
| 233 | + 'jquery.ui.datepicker-he' => array( |
| 234 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-he.js', |
| 235 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 236 | + ), |
| 237 | + 'jquery.ui.datepicker-hr' => array( |
| 238 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hr.js', |
| 239 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 240 | + ), |
| 241 | + 'jquery.ui.datepicker-hu' => array( |
| 242 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hu.js', |
| 243 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 244 | + ), |
| 245 | + 'jquery.ui.datepicker-hy' => array( |
| 246 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-hy.js', |
| 247 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 248 | + ), |
| 249 | + 'jquery.ui.datepicker-id' => array( |
| 250 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-id.js', |
| 251 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 252 | + ), |
| 253 | + 'jquery.ui.datepicker-is' => array( |
| 254 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-is.js', |
| 255 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 256 | + ), |
| 257 | + 'jquery.ui.datepicker-it' => array( |
| 258 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-it.js', |
| 259 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 260 | + ), |
| 261 | + 'jquery.ui.datepicker-ja' => array( |
| 262 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ja.js', |
| 263 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 264 | + ), |
| 265 | + 'jquery.ui.datepicker-ko' => array( |
| 266 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ko.js', |
| 267 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 268 | + ), |
| 269 | + 'jquery.ui.datepicker-lt' => array( |
| 270 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-lt.js', |
| 271 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 272 | + ), |
| 273 | + 'jquery.ui.datepicker-lv' => array( |
| 274 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-lv.js', |
| 275 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 276 | + ), |
| 277 | + 'jquery.ui.datepicker-ms' => array( |
| 278 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ms.js', |
| 279 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 280 | + ), |
| 281 | + 'jquery.ui.datepicker-nl' => array( |
| 282 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-nl.js', |
| 283 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 284 | + ), |
| 285 | + 'jquery.ui.datepicker-no' => array( |
| 286 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-no.js', |
| 287 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 288 | + ), |
| 289 | + 'jquery.ui.datepicker-pl' => array( |
| 290 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-pl.js', |
| 291 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 292 | + ), |
| 293 | + 'jquery.ui.datepicker-pt-BR' => array( |
| 294 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-pt-BR.js', |
| 295 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 296 | + ), |
| 297 | + 'jquery.ui.datepicker-ro' => array( |
| 298 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ro.js', |
| 299 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 300 | + ), |
| 301 | + 'jquery.ui.datepicker-ru' => array( |
| 302 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ru.js', |
| 303 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 304 | + ), |
| 305 | + 'jquery.ui.datepicker-sk' => array( |
| 306 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sk.js', |
| 307 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 308 | + ), |
| 309 | + 'jquery.ui.datepicker-sl' => array( |
| 310 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sl.js', |
| 311 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 312 | + ), |
| 313 | + 'jquery.ui.datepicker-sq' => array( |
| 314 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sq.js', |
| 315 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 316 | + ), |
| 317 | + 'jquery.ui.datepicker-sr-SR' => array( |
| 318 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sr-SR.js', |
| 319 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 320 | + ), |
| 321 | + 'jquery.ui.datepicker-sr' => array( |
| 322 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sr.js', |
| 323 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 324 | + ), |
| 325 | + 'jquery.ui.datepicker-sv' => array( |
| 326 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-sv.js', |
| 327 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 328 | + ), |
| 329 | + 'jquery.ui.datepicker-ta' => array( |
| 330 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-ta.js', |
| 331 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 332 | + ), |
| 333 | + 'jquery.ui.datepicker-th' => array( |
| 334 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-th.js', |
| 335 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 336 | + ), |
| 337 | + 'jquery.ui.datepicker-tr' => array( |
| 338 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-tr.js', |
| 339 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 340 | + ), |
| 341 | + 'jquery.ui.datepicker-uk' => array( |
| 342 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-uk.js', |
| 343 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 344 | + ), |
| 345 | + 'jquery.ui.datepicker-vi' => array( |
| 346 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-vi.js', |
| 347 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 348 | + ), |
| 349 | + 'jquery.ui.datepicker-zh-CN' => array( |
| 350 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-CN.js', |
| 351 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 352 | + ), |
| 353 | + 'jquery.ui.datepicker-zh-HK' => array( |
| 354 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-HK.js', |
| 355 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 356 | + ), |
| 357 | + 'jquery.ui.datepicker-zh-TW' => array( |
| 358 | + 'script' => 'resources/jquery/ui/i18n/jquery.ui.datepicker-zh-TW.js', |
| 359 | + 'needs' => array( 'jquery.ui.datepicker' ), |
| 360 | + ), |
158 | 361 | // Effects |
159 | | - 'jquery.effects.blind' => array( 'script' => 'resources/jquery/effects/jquery.effects.blind.js' ), |
160 | | - 'jquery.effects.bounce' => array( 'script' => 'resources/jquery/effects/jquery.effects.bounce.js' ), |
161 | | - 'jquery.effects.clip' => array( 'script' => 'resources/jquery/effects/jquery.effects.clip.js' ), |
162 | | - 'jquery.effects.core' => array( 'script' => 'resources/jquery/effects/jquery.effects.core.js' ), |
163 | | - 'jquery.effects.drop' => array( 'script' => 'resources/jquery/effects/jquery.effects.drop.js' ), |
164 | | - 'jquery.effects.explode' => array( 'script' => 'resources/jquery/effects/jquery.effects.explode.js' ), |
165 | | - 'jquery.effects.fold' => array( 'script' => 'resources/jquery/effects/jquery.effects.fold.js' ), |
166 | | - 'jquery.effects.highlight' => array( 'script' => 'resources/jquery/effects/jquery.effects.highlight.js' ), |
167 | | - 'jquery.effects.pulsate' => array( 'script' => 'resources/jquery/effects/jquery.effects.pulsate.js' ), |
168 | | - 'jquery.effects.scale' => array( 'script' => 'resources/jquery/effects/jquery.effects.scale.js' ), |
169 | | - 'jquery.effects.shake' => array( 'script' => 'resources/jquery/effects/jquery.effects.shake.js' ), |
170 | | - 'jquery.effects.slide' => array( 'script' => 'resources/jquery/effects/jquery.effects.slide.js' ), |
171 | | - 'jquery.effects.transfer' => array( 'script' => 'resources/jquery/effects/jquery.effects.transfer.js' ), |
| 362 | + 'jquery.effects.blind' => array( |
| 363 | + 'script' => 'resources/jquery/effects/jquery.effects.blind.js', |
| 364 | + 'needs' => array( 'jquery' ), |
| 365 | + ), |
| 366 | + 'jquery.effects.bounce' => array( |
| 367 | + 'script' => 'resources/jquery/effects/jquery.effects.bounce.js', |
| 368 | + 'needs' => array( 'jquery' ), |
| 369 | + ), |
| 370 | + 'jquery.effects.clip' => array( |
| 371 | + 'script' => 'resources/jquery/effects/jquery.effects.clip.js', |
| 372 | + 'needs' => array( 'jquery' ), |
| 373 | + ), |
| 374 | + 'jquery.effects.core' => array( |
| 375 | + 'script' => 'resources/jquery/effects/jquery.effects.core.js', |
| 376 | + 'needs' => array( 'jquery' ), |
| 377 | + ), |
| 378 | + 'jquery.effects.drop' => array( |
| 379 | + 'script' => 'resources/jquery/effects/jquery.effects.drop.js', |
| 380 | + 'needs' => array( 'jquery' ), |
| 381 | + ), |
| 382 | + 'jquery.effects.explode' => array( |
| 383 | + 'script' => 'resources/jquery/effects/jquery.effects.explode.js', |
| 384 | + 'needs' => array( 'jquery' ), |
| 385 | + ), |
| 386 | + 'jquery.effects.fold' => array( |
| 387 | + 'script' => 'resources/jquery/effects/jquery.effects.fold.js', |
| 388 | + 'needs' => array( 'jquery' ), |
| 389 | + ), |
| 390 | + 'jquery.effects.highlight' => array( |
| 391 | + 'script' => 'resources/jquery/effects/jquery.effects.highlight.js', |
| 392 | + 'needs' => array( 'jquery' ), |
| 393 | + ), |
| 394 | + 'jquery.effects.pulsate' => array( |
| 395 | + 'script' => 'resources/jquery/effects/jquery.effects.pulsate.js', |
| 396 | + 'needs' => array( 'jquery' ), |
| 397 | + ), |
| 398 | + 'jquery.effects.scale' => array( |
| 399 | + 'script' => 'resources/jquery/effects/jquery.effects.scale.js', |
| 400 | + 'needs' => array( 'jquery' ), |
| 401 | + ), |
| 402 | + 'jquery.effects.shake' => array( |
| 403 | + 'script' => 'resources/jquery/effects/jquery.effects.shake.js', |
| 404 | + 'needs' => array( 'jquery' ), |
| 405 | + ), |
| 406 | + 'jquery.effects.slide' => array( |
| 407 | + 'script' => 'resources/jquery/effects/jquery.effects.slide.js', |
| 408 | + 'needs' => array( 'jquery' ), |
| 409 | + ), |
| 410 | + 'jquery.effects.transfer' => array( |
| 411 | + 'script' => 'resources/jquery/effects/jquery.effects.transfer.js', |
| 412 | + 'needs' => array( 'jquery' ), |
| 413 | + ), |
172 | 414 | |
173 | 415 | /* MediaWiki */ |
174 | 416 | |
175 | | - 'mediawiki' => array( 'script' => 'resources/mediawiki/mediawiki.js', 'raw' => true ), |
| 417 | + 'mediawiki' => array( |
| 418 | + 'script' => 'resources/mediawiki/mediawiki.js', 'raw' => true ), |
176 | 419 | |
177 | 420 | /* MediaWiki Legacy */ |
178 | 421 | |
179 | | - 'mediawiki.legacy.ajax' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.ajax.js' ), |
180 | | - 'mediawiki.legacy.ajaxwatch' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js' ), |
181 | | - 'mediawiki.legacy.block' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.block.js' ), |
182 | | - 'mediawiki.legacy.changepassword' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.changepassword.js' ), |
183 | | - 'mediawiki.legacy.edit' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.edit.js' ), |
184 | | - 'mediawiki.legacy.enhancedchanges' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js' ), |
185 | | - 'mediawiki.legacy.history' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.history.js' ), |
186 | | - 'mediawiki.legacy.htmlform' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.htmlform.js' ), |
187 | | - 'mediawiki.legacy.IEFixes' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js' ), |
188 | | - 'mediawiki.legacy.metadata' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.metadata.js' ), |
189 | | - 'mediawiki.legacy.mwsuggest' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.mwsuggest.js' ), |
190 | | - 'mediawiki.legacy.prefs' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.prefs.js' ), |
191 | | - 'mediawiki.legacy.preview' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.preview.js' ), |
192 | | - 'mediawiki.legacy.protect' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.protect.js' ), |
193 | | - 'mediawiki.legacy.rightclickedit' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.rightclickedit.js' ), |
194 | | - 'mediawiki.legacy.search' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.search.js' ), |
195 | | - 'mediawiki.legacy.upload' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.upload.js' ), |
196 | | - 'mediawiki.legacy.wikibits' => array( 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.wikibits.js' ), |
| 422 | + 'mediawiki.legacy.ajax' => array( |
| 423 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.ajax.js', |
| 424 | + 'needs' => array( 'mediawiki' ), |
| 425 | + ), |
| 426 | + 'mediawiki.legacy.ajaxwatch' => array( |
| 427 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js', |
| 428 | + 'needs' => array( 'mediawiki' ), |
| 429 | + ), |
| 430 | + 'mediawiki.legacy.block' => array( |
| 431 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.block.js', |
| 432 | + 'needs' => array( 'mediawiki' ), |
| 433 | + ), |
| 434 | + 'mediawiki.legacy.changepassword' => array( |
| 435 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.changepassword.js', |
| 436 | + 'needs' => array( 'mediawiki' ), |
| 437 | + ), |
| 438 | + 'mediawiki.legacy.edit' => array( |
| 439 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.edit.js', |
| 440 | + 'needs' => array( 'mediawiki' ), |
| 441 | + ), |
| 442 | + 'mediawiki.legacy.enhancedchanges' => array( |
| 443 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js', |
| 444 | + 'needs' => array( 'mediawiki' ), |
| 445 | + ), |
| 446 | + 'mediawiki.legacy.history' => array( |
| 447 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.history.js', |
| 448 | + 'needs' => array( 'mediawiki' ), |
| 449 | + ), |
| 450 | + 'mediawiki.legacy.htmlform' => array( |
| 451 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.htmlform.js', |
| 452 | + 'needs' => array( 'mediawiki' ), |
| 453 | + ), |
| 454 | + 'mediawiki.legacy.IEFixes' => array( |
| 455 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js', |
| 456 | + 'needs' => array( 'mediawiki' ), |
| 457 | + ), |
| 458 | + 'mediawiki.legacy.metadata' => array( |
| 459 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.metadata.js', |
| 460 | + 'needs' => array( 'mediawiki' ), |
| 461 | + ), |
| 462 | + 'mediawiki.legacy.mwsuggest' => array( |
| 463 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.mwsuggest.js', |
| 464 | + 'needs' => array( 'mediawiki' ), |
| 465 | + ), |
| 466 | + 'mediawiki.legacy.prefs' => array( |
| 467 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.prefs.js', |
| 468 | + 'needs' => array( 'mediawiki' ), |
| 469 | + ), |
| 470 | + 'mediawiki.legacy.preview' => array( |
| 471 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.preview.js', |
| 472 | + 'needs' => array( 'mediawiki' ), |
| 473 | + ), |
| 474 | + 'mediawiki.legacy.protect' => array( |
| 475 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.protect.js', |
| 476 | + 'needs' => array( 'mediawiki' ), |
| 477 | + ), |
| 478 | + 'mediawiki.legacy.rightclickedit' => array( |
| 479 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.rightclickedit.js', |
| 480 | + 'needs' => array( 'mediawiki' ), |
| 481 | + ), |
| 482 | + 'mediawiki.legacy.search' => array( |
| 483 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.search.js', |
| 484 | + 'needs' => array( 'mediawiki' ), |
| 485 | + ), |
| 486 | + 'mediawiki.legacy.upload' => array( |
| 487 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.upload.js', |
| 488 | + 'needs' => array( 'mediawiki' ), |
| 489 | + ), |
| 490 | + 'mediawiki.legacy.wikibits' => array( |
| 491 | + 'script' => 'resources/mediawiki/legacy/mediawiki.legacy.wikibits.js', |
| 492 | + 'needs' => array( 'mediawiki' ), |
| 493 | + ), |
197 | 494 | |
198 | 495 | /* MediaWiki Utilities */ |
199 | 496 | |
200 | | - 'mediawiki.utilities.client' => array( 'script' => 'resources/mediawiki/utilities/mediawiki.utilities.client.js' ), |
| 497 | + 'mediawiki.utilities.client' => array( |
| 498 | + 'script' => 'resources/mediawiki/utilities/mediawiki.utilities.client.js', |
| 499 | + ), |
201 | 500 | |
202 | 501 | /* MediaWiki Views */ |
203 | 502 | |
204 | | - 'mediawiki.views.diff' => array( 'script' => 'resources/mediawiki/views/mediawiki.views.diff.js' ), |
205 | | - 'mediawiki.views.install' => array( 'script' => 'resources/mediawiki/views/mediawiki.views.install.js' ), |
| 503 | + 'mediawiki.views.diff' => array( |
| 504 | + 'script' => 'resources/mediawiki/views/mediawiki.views.diff.js', |
| 505 | + ), |
| 506 | + 'mediawiki.views.install' => array( |
| 507 | + 'script' => 'resources/mediawiki/views/mediawiki.views.install.js', |
| 508 | + ), |
206 | 509 | |
207 | 510 | /* Test */ |
208 | 511 | |
209 | 512 | 'test' => array( |
210 | 513 | 'script' => 'resources/test/test.js', |
211 | | - 'loader' => 'resources/test/loader.js', |
| 514 | + 'needs' => array( 'foo' ), |
212 | 515 | 'style' => 'resources/test/test.css', |
213 | 516 | ), |
214 | 517 | 'foo' => array( |
215 | 518 | 'script' => 'resources/test/foo.js', |
216 | | - 'loader' => 'resources/test/loader.js', |
| 519 | + 'needs' => array( 'bar' ), |
217 | 520 | 'style' => 'resources/test/foo.css', |
218 | 521 | 'messages' => array( 'january', 'february', 'march', 'april', 'may', 'june' ), |
219 | 522 | ), |
220 | 523 | 'bar' => array( |
221 | 524 | 'script' => 'resources/test/bar.js', |
222 | | - 'loader' => 'resources/test/loader.js', |
| 525 | + 'needs' => array( 'buz' ), |
223 | 526 | 'style' => 'resources/test/bar.css', |
224 | 527 | 'messages' => array( 'july', 'august', 'september', 'october', 'november', 'december' ), |
225 | 528 | ), |
226 | 529 | 'buz' => array( |
227 | 530 | 'script' => 'resources/test/buz.js', |
228 | | - 'loader' => 'resources/test/loader.js', |
| 531 | + 'needs' => array( 'baz' ), |
229 | 532 | 'style' => 'resources/test/buz.css', |
230 | 533 | ), |
231 | 534 | 'baz' => array( |
232 | 535 | 'script' => 'resources/test/baz.js', |
233 | | - 'loader' => 'resources/test/loader.js', |
234 | 536 | 'style' => 'resources/test/baz.css', |
235 | 537 | ), |
236 | 538 | ) ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -232,6 +232,24 @@ |
233 | 233 | /* Private Methods */ |
234 | 234 | |
235 | 235 | /** |
| 236 | + * Recursively resolves dependencies and detects circular references |
| 237 | + */ |
| 238 | + function recurse( module, resolved, unresolved ) { |
| 239 | + unresolved[unresolved.length] = module; |
| 240 | + for ( var n = 0; n < registry[module].needs.length; n++ ) { |
| 241 | + if ( resolved.indexOf( registry[module].needs[n] ) === -1 ) { |
| 242 | + if ( unresolved.indexOf( registry[module].needs[n] ) !== -1 ) { |
| 243 | + throw new Error( |
| 244 | + 'Circular reference detected: ' + module + ' -> ' + registry[module].needs[n] |
| 245 | + ); |
| 246 | + } |
| 247 | + recurse( registry[module].needs[n], resolved, unresolved ); |
| 248 | + } |
| 249 | + } |
| 250 | + resolved[resolved.length] = module; |
| 251 | + unresolved.splice( unresolved.indexOf( module ), 1 ); |
| 252 | + } |
| 253 | + /** |
236 | 254 | * Gets a list of modules names that a module needs in their proper dependency order |
237 | 255 | * |
238 | 256 | * @param mixed string module name or array of string module names |
— | — | @@ -254,22 +272,6 @@ |
255 | 273 | if ( !( module in registry ) ) { |
256 | 274 | return []; |
257 | 275 | } |
258 | | - // Recursively resolves dependencies and detects circular references |
259 | | - function recurse( module, resolved, unresolved ) { |
260 | | - unresolved[unresolved.length] = module; |
261 | | - for ( var n = 0; n < registry[module].needs; n++ ) { |
262 | | - if ( resolved.indexOf( registry[module].needs[n] ) === -1 ) { |
263 | | - if ( unresolved.indexOf( registry[module].needs[n] ) !== -1 ) { |
264 | | - throw new Error( |
265 | | - 'Circular reference detected: ' + module + ' -> ' + registry[module].needs[n] |
266 | | - ); |
267 | | - } |
268 | | - recurse( registry[module].needs[n], resolved, unresolved ); |
269 | | - } |
270 | | - } |
271 | | - resolved[resolved.length] = module; |
272 | | - unresolved.splice( unresolved.indexOf( module ), 1 ); |
273 | | - } |
274 | 276 | var resolved = []; |
275 | 277 | recurse( module, resolved, [] ); |
276 | 278 | return resolved; |
— | — | @@ -465,47 +467,47 @@ |
466 | 468 | * Registers a module, letting the system know about it and it's dependencies. loader.js files contain calls |
467 | 469 | * to this function. |
468 | 470 | */ |
469 | | - this.register = function( name, needs ) { |
| 471 | + this.register = function( module, needs, status ) { |
470 | 472 | // Allow multiple registration |
471 | | - if ( typeof name === 'object' ) { |
472 | | - for ( var n = 0; n < name.length; n++ ) { |
473 | | - if ( typeof name[n] === 'string' ) { |
474 | | - that.register( name[n] ); |
475 | | - } else if ( typeof name[n] === 'object' && name[n].length == 2 ) { |
476 | | - that.register( name[n][0], name[n][1] ); |
| 473 | + if ( typeof module === 'object' ) { |
| 474 | + for ( var n = 0; n < module.length; n++ ) { |
| 475 | + if ( typeof module[n] === 'string' ) { |
| 476 | + that.register( module[n] ); |
| 477 | + } else if ( typeof module[n] === 'object' ) { |
| 478 | + that.register.apply( that, module[n] ); |
477 | 479 | } |
478 | 480 | } |
479 | 481 | return; |
480 | 482 | } |
481 | 483 | // Validate input |
482 | | - if ( typeof name !== 'string' ) { |
483 | | - throw new Error( 'name must be a string, not a ' + typeof name ); |
| 484 | + if ( typeof module !== 'string' ) { |
| 485 | + throw new Error( 'module must be a string, not a ' + typeof module ); |
484 | 486 | } |
485 | | - if ( typeof registry[name] !== 'undefined' ) { |
486 | | - throw new Error( 'module already implemeneted: ' + name ); |
| 487 | + if ( typeof registry[module] !== 'undefined' && typeof status === 'undefined' ) { |
| 488 | + throw new Error( 'module already implemeneted: ' + module ); |
487 | 489 | } |
488 | 490 | // List the module as registered |
489 | | - registry[name] = { 'state': 'registered', 'needs': [] }; |
| 491 | + registry[module] = { 'state': typeof status === 'string' ? status : 'registered', 'needs': [] }; |
490 | 492 | // Allow needs to be given as a function which returns a string or array |
491 | 493 | if ( typeof needs === 'function' ) { |
492 | 494 | needs = needs(); |
493 | 495 | } |
494 | 496 | if ( typeof needs === 'string' ) { |
495 | | - // Allow needs to be given as a single module name |
496 | | - registry[name].needs = [needs]; |
| 497 | + // Allow needs to be given as a single module module |
| 498 | + registry[module].needs = [needs]; |
497 | 499 | } else if ( typeof needs === 'object' ) { |
498 | | - // Allow needs to be given as an array of module names |
499 | | - registry[name].needs = needs; |
| 500 | + // Allow needs to be given as an array of module modules |
| 501 | + registry[module].needs = needs; |
500 | 502 | } |
501 | 503 | }; |
502 | 504 | /** |
503 | 505 | * Implements a module, giving the system a course of action to take upon loading. Results of a request for |
504 | 506 | * one or more modules contain calls to this function. |
505 | 507 | */ |
506 | | - this.implement = function( name, script, style, localization ) { |
| 508 | + this.implement = function( module, script, style, localization ) { |
507 | 509 | // Automaically register module |
508 | | - if ( typeof registry[name] === 'undefined' ) { |
509 | | - that.register( name ); |
| 510 | + if ( typeof registry[module] === 'undefined' ) { |
| 511 | + that.register( module ); |
510 | 512 | } |
511 | 513 | // Validate input |
512 | 514 | if ( typeof script !== 'function' ) { |
— | — | @@ -517,24 +519,24 @@ |
518 | 520 | if ( typeof localization !== 'undefined' && typeof localization !== 'object' ) { |
519 | 521 | throw new Error( 'localization must be an object, not a ' + typeof localization ); |
520 | 522 | } |
521 | | - if ( typeof registry[name] !== 'undefined' && typeof registry[name].script !== 'undefined' ) { |
522 | | - throw new Error( 'module already implemeneted: ' + name ); |
| 523 | + if ( typeof registry[module] !== 'undefined' && typeof registry[module].script !== 'undefined' ) { |
| 524 | + throw new Error( 'module already implemeneted: ' + module ); |
523 | 525 | } |
524 | 526 | // Mark module as loaded |
525 | | - registry[name].state = 'loaded'; |
| 527 | + registry[module].state = 'loaded'; |
526 | 528 | // Attach components |
527 | | - registry[name].script = script; |
| 529 | + registry[module].script = script; |
528 | 530 | if ( typeof style === 'string' ) { |
529 | | - registry[name].style = style; |
| 531 | + registry[module].style = style; |
530 | 532 | } |
531 | 533 | if ( typeof messages === 'object' ) { |
532 | | - registry[name].messages = messages; |
| 534 | + registry[module].messages = messages; |
533 | 535 | } |
534 | 536 | // Execute or queue callback |
535 | | - if ( filter( ['ready'], registry[name].needs ).compare( registry[name].needs ) ) { |
536 | | - execute( name ); |
| 537 | + if ( filter( ['ready'], registry[module].needs ).compare( registry[module].needs ) ) { |
| 538 | + execute( module ); |
537 | 539 | } else { |
538 | | - request( name ); |
| 540 | + request( module ); |
539 | 541 | } |
540 | 542 | }; |
541 | 543 | /** |
— | — | @@ -572,6 +574,34 @@ |
573 | 575 | request( needs, ready, error ); |
574 | 576 | } |
575 | 577 | }; |
| 578 | + /** |
| 579 | + * Loads one or more modules for future use |
| 580 | + */ |
| 581 | + this.load = function( modules ) { |
| 582 | + // Validate input |
| 583 | + if ( typeof modules !== 'object' && typeof modules !== 'string' ) { |
| 584 | + throw new Error( 'needs must be a string or an array, not a ' + typeof needs ) |
| 585 | + } |
| 586 | + // Allow calling with a single need as a string |
| 587 | + if ( typeof modules === 'string' ) { |
| 588 | + modules = [needs]; |
| 589 | + } |
| 590 | + // Resolve entire dependency map |
| 591 | + modules = resolve( modules ); |
| 592 | + // If all modules are ready, nothing need be done |
| 593 | + if ( filter( ['ready'], modules ).compare( modules ) ) { |
| 594 | + return true; |
| 595 | + } |
| 596 | + // If any modules have errors return false |
| 597 | + else if ( filter( ['error'], modules ).length ) { |
| 598 | + return false; |
| 599 | + } |
| 600 | + // Since some modules are not yet ready, queue up a request |
| 601 | + else { |
| 602 | + request( modules ); |
| 603 | + return true; |
| 604 | + } |
| 605 | + }; |
576 | 606 | |
577 | 607 | /* Event Bindings */ |
578 | 608 | |