3 * ResourceLoader module for skin stylesheets.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 class ResourceLoaderSkinModule
extends ResourceLoaderFileModule
{
27 * @param ResourceLoaderContext $context
30 public function getStyles( ResourceLoaderContext
$context ) {
31 $conf = $this->getConfig();
32 $logo = $conf->get( 'Logo' );
33 $logoHD = $conf->get( 'LogoHD' );
35 $logo1 = OutputPage
::transformResourcePath( $conf, $logo );
36 $logo15 = OutputPage
::transformResourcePath( $conf, $logoHD['1.5x'] );
37 $logo2 = OutputPage
::transformResourcePath( $conf, $logoHD['2x'] );
39 $styles = parent
::getStyles( $context );
40 $styles['all'][] = '.mw-wiki-logo { background-image: ' .
41 CSSMin
::buildUrlValue( $logo1 ) .
43 // Only 1.5x and 2x are supported
44 // Note: Keep in sync with OutputPage::addLogoPreloadLinkHeaders()
46 if ( isset( $logoHD['1.5x'] ) ) {
48 '(-webkit-min-device-pixel-ratio: 1.5), ' .
49 '(min--moz-device-pixel-ratio: 1.5), ' .
50 '(min-resolution: 1.5dppx), ' .
51 '(min-resolution: 144dpi)'
52 ][] = '.mw-wiki-logo { background-image: ' .
53 CSSMin
::buildUrlValue( $logo15 ) . ';' .
54 'background-size: 135px auto; }';
56 if ( isset( $logoHD['2x'] ) ) {
58 '(-webkit-min-device-pixel-ratio: 2), ' .
59 '(min--moz-device-pixel-ratio: 2),' .
60 '(min-resolution: 2dppx), ' .
61 '(min-resolution: 192dpi)'
62 ][] = '.mw-wiki-logo { background-image: ' .
63 CSSMin
::buildUrlValue( $logo2 ) . ';' .
64 'background-size: 135px auto; }';
71 * @param ResourceLoaderContext $context
74 public function isKnownEmpty( ResourceLoaderContext
$context ) {
75 // Regardless of whether the files are specified, we always
76 // provide mw-wiki-logo styles.
80 public function getDefinitionSummary( ResourceLoaderContext
$context ) {
81 $summary = parent
::getDefinitionSummary( $context );
83 'logo' => $this->getConfig()->get( 'Logo' ),
84 'logoHD' => $this->getConfig()->get( 'LogoHD' ),