* will actually fill the template.
*/
var $template;
-
+
/**
* An array of stylesheet filenames (relative from skins path), with options
* for CSS media, IE conditions, and RTL/LTR direction.
$this->skinname = 'monobook';
$this->stylename = 'monobook';
$this->template = 'QuickTemplate';
-
+
$this->addStyle( 'common/shared.css', 'screen' );
$this->addStyle( 'common/commonPrint.css', 'print' );
}
*/
function setupUserCss() {
global $wgRequest, $wgAllowUserCss, $wgUseSiteCss, $wgContLang, $wgSquidMaxage, $wgStylePath, $wgUser;
-
+
wfProfileIn( __METHOD__ );
$siteargs = array(
# if we're previewing the CSS page, use it
if( $this->mTitle->isCssSubpage() && $this->userCanPreview( $action ) ) {
$previewCss = $wgRequest->getText('wpTextbox1');
-
+
/// @fixme properly escape the cdata!
$this->usercss = "/*<![CDATA[*/\n" .
$previewCss .
'action=raw&ctype=text/css'), 'screen' );
}
}
-
+
wfProfileOut( __METHOD__ );
}
wfProfileOut( __METHOD__ );
return $s;
}
-
+
/**
* Add a local or specified stylesheet, with the given media options.
* Meant primarily for internal use...
* These will be applied to various media & IE conditionals.
*/
protected function buildCssLinks() {
+ $links = array();
foreach( $this->styles as $file => $options ) {
$link = $this->styleLink( $file, $options );
if( $link )
$links[] = $link;
}
-
+
return implode( "\n\t\t", $links );
}
-
+
protected function styleLink( $style, $options ) {
global $wgRequest;
-
+
if( isset( $options['dir'] ) ) {
global $wgContLang;
$siteDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
if( $siteDir != $options['dir'] )
return '';
}
-
+
if( isset( $options['media'] ) ) {
$media = $this->transformCssMedia( $options['media'] );
if( is_null( $media ) ) {
} else {
$media = '';
}
-
+
if( substr( $style, 0, 1 ) == '/' ||
substr( $style, 0, 5 ) == 'http:' ||
substr( $style, 0, 6 ) == 'https:' ) {
global $wgStylePath, $wgStyleVersion;
$url = $wgStylePath . '/' . $style . '?' . $wgStyleVersion;
}
-
+
$attribs = array(
'rel' => 'stylesheet',
'href' => $url,
}
return $link;
}
-
+
function transformCssMedia( $media ) {
global $wgRequest, $wgHandheldForIPhone;
-
+
// Switch in on-screen display for media testing
$switches = array(
'printable' => 'print',
}
}
}
-
+
// Expand longer media queries as iPhone doesn't grok 'handheld'
if( $wgHandheldForIPhone ) {
$mediaAliases = array(
'screen' => 'screen and (min-device-width: 481px)',
'handheld' => 'handheld, only screen and (max-device-width: 480px)',
);
-
+
if( isset( $mediaAliases[$media] ) ) {
$media = $mediaAliases[$media];
}
}
-
+
return $media;
}