Index: trunk/phase3/includes/ResourceLoaderContext.php |
— | — | @@ -33,7 +33,6 @@ |
34 | 34 | protected $skin; |
35 | 35 | protected $debug; |
36 | 36 | protected $only; |
37 | | - protected $media; |
38 | 37 | protected $hash; |
39 | 38 | |
40 | 39 | /* Methods */ |
— | — | @@ -50,7 +49,6 @@ |
51 | 50 | $this->skin = $request->getVal( 'skin' ); |
52 | 51 | $this->debug = $request->getVal( 'debug' ) === 'true' || $request->getBool( 'debug' ); |
53 | 52 | $this->only = $request->getVal( 'only' ); |
54 | | - $this->media = $request->getVal( 'media', 'all' ); |
55 | 53 | |
56 | 54 | // Fallback on system defaults |
57 | 55 | if ( !$this->language ) { |
— | — | @@ -97,10 +95,6 @@ |
98 | 96 | public function getOnly() { |
99 | 97 | return $this->only; |
100 | 98 | } |
101 | | - |
102 | | - public function getMedia() { |
103 | | - return $this->media; |
104 | | - } |
105 | 99 | |
106 | 100 | public function shouldIncludeScripts() { |
107 | 101 | return is_null( $this->only ) || $this->only === 'scripts'; |
— | — | @@ -117,6 +111,6 @@ |
118 | 112 | public function getHash() { |
119 | 113 | return isset( $this->hash ) ? |
120 | 114 | $this->hash : $this->hash = |
121 | | - implode( '|', array( $this->language, $this->skin, $this->debug, $this->only, $this->media ) ); |
| 115 | + implode( '|', array( $this->language, $this->skin, $this->debug, $this->only ) ); |
122 | 116 | } |
123 | 117 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2280,7 +2280,7 @@ |
2281 | 2281 | return $ret; |
2282 | 2282 | } |
2283 | 2283 | |
2284 | | - static function makeResourceLoaderLink( $skin, $modules, $only, $media = 'all' ) { |
| 2284 | + static function makeResourceLoaderLink( $skin, $modules, $only ) { |
2285 | 2285 | global $wgUser, $wgLang, $wgRequest; |
2286 | 2286 | // TODO: Should this be a static function of ResourceLoader instead? |
2287 | 2287 | $query = array( |
— | — | @@ -2292,8 +2292,7 @@ |
2293 | 2293 | ); |
2294 | 2294 | // Automatically select style/script elements |
2295 | 2295 | if ( $only === 'styles' ) { |
2296 | | - $query['media'] = $media; |
2297 | | - return Html::linkedStyle( wfAppendQuery( wfScript( 'load' ), $query ), $media ); |
| 2296 | + return Html::linkedStyle( wfAppendQuery( wfScript( 'load' ), $query ) ); |
2298 | 2297 | } else { |
2299 | 2298 | return Html::linkedScript( wfAppendQuery( wfScript( 'load' ), $query ) ); |
2300 | 2299 | } |
— | — | @@ -2489,15 +2488,11 @@ |
2490 | 2489 | // Support individual script requests in debug mode |
2491 | 2490 | if ( $wgRequest->getBool( 'debug' ) && $wgRequest->getVal( 'debug' ) !== 'false' ) { |
2492 | 2491 | foreach ( $this->getModuleStyles() as $name ) { |
2493 | | - $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles', 'all' ); |
2494 | | - $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles', 'screen' ); |
2495 | | - $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles', 'print' ); |
| 2492 | + $tags[] = self::makeResourceLoaderLink( $sk, $name, 'styles' ); |
2496 | 2493 | } |
2497 | 2494 | } else { |
2498 | 2495 | if ( count( $this->getModuleStyles() ) ) { |
2499 | | - $tags[] = self::makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles', 'all' ); |
2500 | | - $tags[] = self::makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles', 'screen' ); |
2501 | | - $tags[] = self::makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles', 'print' ); |
| 2496 | + $tags[] = self::makeResourceLoaderLink( $sk, $this->getModuleStyles(), 'styles' ); |
2502 | 2497 | } |
2503 | 2498 | } |
2504 | 2499 | |
Index: trunk/phase3/includes/ResourceLoader.php |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | |
277 | 277 | // Pre-fetch blobs |
278 | 278 | $blobs = $context->shouldIncludeMessages() ? |
279 | | - MessageBlobStore::get( $modules, $context->getLanguage() ) : array(); |
| 279 | + MessageBlobStore::get( $modules, $context->getLanguage() ) : array(); |
280 | 280 | |
281 | 281 | // Generate output |
282 | 282 | foreach ( $modules as $name ) { |
— | — | @@ -290,8 +290,7 @@ |
291 | 291 | $styles = array(); |
292 | 292 | |
293 | 293 | if ( |
294 | | - $context->shouldIncludeStyles() && |
295 | | - ( count( $styles = self::$modules[$name]->getStyles( $context ) ) ) |
| 294 | + $context->shouldIncludeStyles() && ( count( $styles = self::$modules[$name]->getStyles( $context ) ) ) |
296 | 295 | ) { |
297 | 296 | foreach ( $styles as $media => $style ) { |
298 | 297 | if ( self::$modules[$name]->getFlip( $context ) ) { |
— | — | @@ -308,8 +307,8 @@ |
309 | 308 | |
310 | 309 | // Output |
311 | 310 | if ( $context->getOnly() === 'styles' ) { |
312 | | - if ( isset( $styles[$context->getMedia()] ) ) { |
313 | | - echo $styles[$context->getMedia()]; |
| 311 | + foreach ( $styles as $media => $style ) { |
| 312 | + echo "@media $media {\n$style\n}\n"; |
314 | 313 | } |
315 | 314 | } else if ( $context->getOnly() === 'scripts' ) { |
316 | 315 | echo $scripts; |