| @@ 1184-1198 (lines=15) @@ | ||
| 1181 | * @param string $state |
|
| 1182 | * @return string |
|
| 1183 | */ |
|
| 1184 | public static function makeLoaderStateScript( $name, $state = null ) { |
|
| 1185 | if ( is_array( $name ) ) { |
|
| 1186 | return Xml::encodeJsCall( |
|
| 1187 | 'mw.loader.state', |
|
| 1188 | [ $name ], |
|
| 1189 | ResourceLoader::inDebugMode() |
|
| 1190 | ); |
|
| 1191 | } else { |
|
| 1192 | return Xml::encodeJsCall( |
|
| 1193 | 'mw.loader.state', |
|
| 1194 | [ $name, $state ], |
|
| 1195 | ResourceLoader::inDebugMode() |
|
| 1196 | ); |
|
| 1197 | } |
|
| 1198 | } |
|
| 1199 | ||
| 1200 | /** |
|
| 1201 | * Returns JS code which calls the script given by $script. The script will |
|
| @@ 1340-1354 (lines=15) @@ | ||
| 1337 | * @param array $properties Source properties (see addSource()) |
|
| 1338 | * @return string |
|
| 1339 | */ |
|
| 1340 | public static function makeLoaderSourcesScript( $id, $properties = null ) { |
|
| 1341 | if ( is_array( $id ) ) { |
|
| 1342 | return Xml::encodeJsCall( |
|
| 1343 | 'mw.loader.addSource', |
|
| 1344 | [ $id ], |
|
| 1345 | ResourceLoader::inDebugMode() |
|
| 1346 | ); |
|
| 1347 | } else { |
|
| 1348 | return Xml::encodeJsCall( |
|
| 1349 | 'mw.loader.addSource', |
|
| 1350 | [ $id, $properties ], |
|
| 1351 | ResourceLoader::inDebugMode() |
|
| 1352 | ); |
|
| 1353 | } |
|
| 1354 | } |
|
| 1355 | ||
| 1356 | /** |
|
| 1357 | * Returns JS code which runs given JS code if the client-side framework is |
|