Start on some cleanup of how CSS stylesheets are loaded. Initially addressing only...
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 28 Jul 2008 05:09:08 +0000 (05:09 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 28 Jul 2008 05:09:08 +0000 (05:09 +0000)
commitdc821ec18d2f37a084cf44ae3d9f87160cb3a5a5
tree06b6b2248fd955e82c789130eae0567809168e66
parent6f80584581929492537f42ae5be6e621686fa916
Start on some cleanup of how CSS stylesheets are loaded. Initially addressing only the SkinTemplate-based skins; would like to rip out some near-dupe code in the other skin types, with a little more refactoring...

* A skin can make calls to $this->addScript to much more cleanly list which style sheets it wants to load, for which media variants and which IE conditional versions. This replaces the 'cssfiles' array hack and giant pile of ugly conditionals in MonoBook's template.

* 'printable=yes' and 'handheld=yes' URL options are handled transparently -- 'screen' stylesheets are hidden, while those with no media specifier are left.

MediaWiki:Common.css is now listed without media -- so infoboxes are still formatted -- while the skin-specific eg MediaWiki:Monobook.css are listed for screen, as they're specific to the on-screen skin.

Note it should be a matter of one line of code to add a MediaWiki:Print.css and have it correctly handled now.

* All sheets are now loaded via <link rel="stylesheet"> instead of a mix of those and @import decls.

IIRC we had used @import originally to hide styles from Netscape 4, which tends to utterly break on MonoBook, but these days that's pretty much a non-issue.
@import also breaks some browsers' ability to save stylesheets with a file to disk, which sucks.

Confirmed that Firefox 3 can now save pages with their styles.

* 'screen, projection' media specifier has been changed to just 'screen' -- projection is something totally different.

* Added experimental options for specifying handheld stylesheets:

/**
 * Optionally, we can specify a stylesheet to use for media="handheld".
 * This is recognized by some, but not all, handheld/mobile/PDA browsers.
 * If left empty, compliant handheld browsers won't pick up the skin
 * stylesheet, which is specified for 'screen' media.
 *
 * Can be a complete URL, base-relative path, or $wgStylePath-relative path.
 * Try 'chick/main.css' to apply the Chick styles to the MonoBook HTML.
 *
 * Will also be switched in when 'handheld=yes' is added to the URL, like
 * the 'printable=yes' mode for print media.
 */
$wgHandheldStyle = false;

/**
 * If set, 'screen' and 'handheld' media specifiers for stylesheets are
 * transformed such that they apply to the iPhone/iPod Touch Mobile Safari,
 * which doesn't recognize 'handheld' but does support media queries on its
 * screen size.
 *
 * Consider only using this if you have a *really good* handheld stylesheet,
 * as iPhone users won't have any way to disable it and use the "grown-up"
 * styles instead.
 */
$wgHandheldForIPhone = false;
includes/DefaultSettings.php
includes/SkinTemplate.php
skins/Chick.php
skins/MonoBook.php
skins/chick/main.css