http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99315
Revision: 99315 Author: ashley Date: 2011-10-08 17:55:30 +0000 (Sat, 08 Oct 2011) Log Message: ----------- Theme: new version, 1.5: *supports (=requires) ResourceLoader (and thus at least MediaWiki 1.17) *more self-contained than before -- core themes are stored now in extensions/Theme instead of skins/skinname/themes *two themes for Monobook, dark and pink *ignore Monaco skin in wfDisplayTheme Modified Paths: -------------- trunk/extensions/Theme/Theme.php Added Paths: ----------- trunk/extensions/Theme/monobook/ trunk/extensions/Theme/monobook/dark.css trunk/extensions/Theme/monobook/pink.css Modified: trunk/extensions/Theme/Theme.php =================================================================== --- trunk/extensions/Theme/Theme.php 2011-10-08 17:42:10 UTC (rev 99314) +++ trunk/extensions/Theme/Theme.php 2011-10-08 17:55:30 UTC (rev 99315) @@ -1,34 +1,93 @@ <?php +/** + * Theme "extension" (allows using themes of skins) + * + * @file + * @ingroup Extensions + * @version 1.5 + * @author Ryan Schmidt <skizzerz at gmail dot com> + * @author Jack Phoenix <j...@countervandalism.net> + * @license http://en.wikipedia.org/wiki/Public_domain Public domain + * @link http://www.mediawiki.org/wiki/Extension:Theme Documentation + */ -//Theme "extension" (allows using themes of skins) +if ( !defined( 'MEDIAWIKI' ) ) { + die(); +} +// Extension credits that will show up on Special:Version $wgExtensionCredits['other'][] = array( 'name' => 'Theme', + 'version' => '1.5', + 'author' => array( 'Ryan Schmidt', 'Jack Phoenix' ), 'description' => 'Theme loader extension for skins', - 'version' => '1.0', - 'author' => 'Ryan Schmidt', + 'url' => 'http://www.mediawiki.org/wiki/Extension:Theme' ); -$wgHooks['BeforePageDisplay'][] = 'efDisplayTheme'; +// For ShoutWiki, $wgDefaultTheme is set in GlobalSettings.php to 'default' +// For a non-ShoutWiki site where you want to use this extension, you should +// set $wgDefaultTheme to the name of one of the available themes for your +// $wgDefaultSkin -function efDisplayTheme( &$out, &$sk ) { +// Register themes for core skins here; for custom skins, do the registration +// in the custom skin's Skinname.php file +// +// Monobook +$wgResourceModules['skins.monobook.dark'] = array( + 'styles' => array( + 'extensions/Theme/monobook/dark.css' => array( 'media' => 'screen' ) + ) +); + +$wgResourceModules['skins.monobook.pink'] = array( + 'styles' => array( + 'extensions/Theme/monobook/pink.css' => array( 'media' => 'screen' ) + ) +); + +// Actual extension logic begins here +$wgHooks['BeforePageDisplay'][] = 'wfDisplayTheme'; + +function wfDisplayTheme( &$out, &$sk ) { global $wgRequest, $wgStylePath, $wgStyleDirectory, $wgDefaultTheme, $wgValidSkinNames; + global $wgResourceModules; + $theme = $wgRequest->getVal( 'usetheme', false ); $useskin = $wgRequest->getVal( 'useskin', false ); $skin = $useskin ? $useskin : $sk->getSkinName(); + if( !array_key_exists( strtolower( $skin ), $wgValidSkinNames ) ) { - $skin = $sk->getSkinName(); //so we don't load themes for skins when we can't actually load the skin + // so we don't load themes for skins when we can't actually load the skin + $skin = $sk->getSkinName(); } + + // Monaco is a special case, since it handles its themes in its main PHP + // file instead of leaving theme handling to us (ShoutWiki bug #173) + if ( strtolower( $skin ) == 'monaco' ) { + return true; + } + if( $theme ) { - $url = $skin . '/themes/' . $theme . '.css'; + $themeName = $theme; } elseif( isset( $wgDefaultTheme ) && $wgDefaultTheme != 'default' ) { - $url = $skin . '/themes/' . $wgDefaultTheme . '.css'; + $themeName = $wgDefaultTheme; } else { - $url = false; + $themeName = false; } - if( !$url || !file_exists( $wgStyleDirectory . '/' . $url ) ) { + + $moduleName = 'skins.' . strtolower( $skin ) . '.' . + strtolower( $themeName ); + + // Check that we have something to include later on; if not, bail out + if( !$themeName || !isset( $wgResourceModules[$moduleName] ) ) { return true; } - $out->addExtensionStyle( $wgStylePath . '/' . $url ); + + // Add the CSS file, either via ResourceLoader or the old (1.16) way. + // When adding via RL, we also check that such a module has been registered + // (above, in the if() loop) because RL may explode if we try to add a + // module that does not exist. + $out->addModuleStyles( $moduleName ); + return true; } \ No newline at end of file Added: trunk/extensions/Theme/monobook/dark.css =================================================================== --- trunk/extensions/Theme/monobook/dark.css (rev 0) +++ trunk/extensions/Theme/monobook/dark.css 2011-10-08 17:55:30 UTC (rev 99315) @@ -0,0 +1,418 @@ +/* +** Dark theme for MonoBook +** Originally from ZeldaWiki.org and modified by Skizzerz <skizz...@shoutwiki.com> for ShoutWiki +** +** @date 14 September 2011 +*/ +div#content { + background: #1c3855; + color: #d2d2d2; + border: 2px solid #6f7b87; +} + +body { + background: #0a2139; + color: #d2d2d2; +} + +table { + background-color: #1c3855; +} + +a { + color: #e9eda6; +} + +a:visited { + color: #e6ed79; +} + +a:active { + color: #eaeda6; +} + +a.stub { + color: #eaeda6; +} + +a.new, #p-personal a.new { + color: #fe6060; +} + +a.new:visited, #p-personal a.new:visited { + color: #fe6060; +} + +hr { + background-color: #6f7b87; + color: #6f7b87; +} + +h1, h2, h3, h4, h5, h6 { + border-bottom: 1px solid #485d73; + color: #d2d2d2; +} + +legend { + background: #1c3855; +} + +code { + background-color: #2f6fab; +} + +pre { + background-color: #1f4973; + border: 1px dashed #3b587e; + color: #d2d2d2; +} + +/* user notification thing */ +.usermessage { + background-color: #2f6fab; + border: 1px solid #eaeda6; +} + +.catlinks { + border: 2px solid #3b587e; + background-color: #1f4973; +} + +/* +** content styles +*/ +#toc, +.toc, +.mw-warning { + border: 2px solid #3b587e; + background-color: #1f4973; +} + +div.thumbinner { + background-color: #1f4973; + border: 2px solid #3b587e; +} + +html .thumbimage { + border: 1px solid #3b587e; + background-color: #1c3855; +} + +.toccolours { + border: 2px solid #3b587e; + background-color: #1f4973; +} + +/* Interwiki styling */ +#bodyContent a.extiw, +#bodyContent a.extiw:active { + color: #e9eda6; +} + +#bodyContent a.external { + color: #e9eda6; +} + +#bodyContent a.new { + color: #fe6060; +} + +.portlet h6 { + background: #6f7b87; +} + +.pBody { + background-color: #1d3855; + border: 1px solid #59697a; + color: #d2d2d2; +} + +#p-personal li { + color: #1f4973; +} + +#p-personal li a { + color: #e9eda6; +} + +#p-personal li a:hover { + background-color: #1f4973; +} + +#p-cactions li { + border: 1px solid #6f7b87; + background: #1d3855; +} + +#p-cactions li.selected { + border-color: #eaeda6; +} + +#p-cactions li a { + background-color: #1d3855; + color: #eaeda6; +} + +#p-cactions li.selected a { + background-color: #1d3855; +} + +#p-cactions .new a { + color: #fd6060; +} + +#p-cactions li a:hover { + background-color: #254b73; +} + +/* +** footer +*/ +div#footer { + background-color: #1c3855; + border-top: 1px solid #e1eda6; + border-bottom: 1px solid #e1eda6; +} + +/* js pref toc */ +#preftoc li { + background-color: #1f4973; + border: 1px solid #3b587e; +} + +#preftoc li.selected { + background-color: #1f4973; + border: 1px solid #3b587e; +} + +#preftoc > li.selected { + border-color: #3b587e; +} + +#preftoc a, +#preftoc a:active { + color: #e9eda6; +} + +#preftoc li.selected a { + color: #d2d2d2; +} + +#preferences { + border: 1px solid #3b587e; + background-color: #1f4973; +} + +.prefsection fieldset { + border: 1px solid #3b587e; +} + +.prefsection table, .prefsection legend { + background-color: #1f4973; + border-color: #1f4973; +} + +div.prefsectiontip { + color: #d2d2d2; +} + +div#userloginForm form, +div#userlogin form#userlogin2 { + background-color: #1f4973; + border: 1px solid #3b587e; +} + +div#userloginForm table, +div#userlogin form#userlogin2 table { + background-color: #1c3855; + border: 1px solid #3b587e; +} + +/* @todo FIXME: review and remove unnecessary styles, this is verbatim copy of the old file */ +table.gallery { + border: 2px solid #3b587e; + margin: 2px; + padding: 2px; + background-color: #1f4973; +} + +table.gallery tr { + vertical-align: top; +} + +table.gallery td { + vertical-align: top; + background-color: #1f4973; + border: solid 2px #3b587e; +} +/* Keep this temporarily so that cached pages will display right */ +table.gallery td.galleryheader { + text-align: center; + font-weight: bold; +} +table.gallery caption { + font-weight: bold; +} + +div.gallerybox { + margin: 2px; +} + +div.gallerybox div.thumb { + text-align: center; + border: 1px solid #3b587e; + background-color: #1c3855; + margin: 2px; +} +/* </fixme> */ + +/* Classes for EXIF data display */ +table.mw_metadata { + width: 300px; /* @todo CHECKME: still needed? shared.css has 400px */ +} + +/* filetoc */ +ul#filetoc { + border: 1px solid #3b587e; + background-color: #1f4973; +} + +/* noarticletext */ +.noarticletext { + background: #0A2139; + border: #59697A 1px solid; + color: #59697A; +} + +div.multipageimagenavbox { + border: 1px solid #3b587e; + background: #1f4973; +} + +/** Special:Version */ +table#sv-ext, table#sv-hooks, table#sv-software { + margin: 1em; + padding: 0em; +} + +#sv-ext td, #sv-hooks td, #sv-software td, +#sv-ext th, #sv-hooks th, #sv-software th { + border: 1px solid #A0A0A0; + padding: 0 0.15em 0 0.15em; +} +#sv-ext th, #sv-hooks th, #sv-software th { + background-color: #1F4973; + color: #CBD2D2; + padding: 0 0.15em 0 0.15em; +} +tr.sv-space { + height: 0.8em; + border: none; +} +tr.sv-space td { display: none; } + +/* also used on Special:Version */ +table.wikitable { + background-color: transparent; + color: #d2d2d2; +} + +/* Recreating-deleted-page/reupload file warning and log entries */ +div#mw-upload-deleted-warn, +div#mw-recreate-deleted-warn { + padding: 3px; + margin-bottom: 3px; + border: 2px solid #2F6FAB; +} + +/* Special:Search */ +.mw-search-interwiki-project { + background: #cae8ff; +} + +span.searchmatch { + color: #fe6060; +} + +/* SendToAFriend extension */ +#staf a { + color: #002bb8; +} + +/* The message that is shown after a page is deleted */ +#deletedtextmessage { + background: transparent; +} + +/* AJAX pagewatch / unwatch */ +div#mw-js-message { + background: transparent; +} + +/* Images */ +div.thumb { + border-color: transparent; +} +div.thumb div { + background-color: transparent; +} + +/* Captcha on Special:UserLogin/signup (ConfirmEdit extension) */ +div#userlogin .captcha, div#userloginForm .captcha { + background-color: transparent; +} + +/* @todo FIXME: correct place for these rules! */ +#bodyContent h4.mw-specialpagesgroup { + background-color: #1f4973; + border: 1px solid #3b587e; +} +#bodyContent table#sv-ext th, table#sv-software th, table.filehistory th { + background-color: #1F4973; + color: #CBD2D2; + border: 1px solid #3b587e; +} +#bodyContent table#sv-ext td, table#sv-software td, table.filehistory td { + border: 1px solid #3b587e; +} +#bodyContent ul#pagehistory li { + background: #1f4871; + border-color: #3b587e; +} +#bodyContent ul#pagehistory li.selected { + background: #0a2139; + border: 1px solid #3b587e; +} +#bodyContent table#allmessagestable { + border: 1px solid #3b587e; +} +#bodyContent table#allmessagestable th { + background: #0a2139; + border: 1px solid #3b587e; +} +#bodyContent table#allmessagestable td { + background: #1f4871; + border: 1px solid #3b587e; +} +#bodyContent div.noarticletext { + color: #d2d2d2; + background: #1f4871; + border: 2px solid #3b587e; +} +table.diff, td.diff-otitle, td.diff-ntitle { + background: none; +} +td.diff-context { + background: #6f7b87; +} +td.diff-deletedline { + background: #e6ed78; + color: #1c3855; +} +td.diff-addedline { + background: #76e983; + color: #1c3855; +} +td.diff-addedline ins, td.diff-deletedline del { + color: #a33d3d; +} \ No newline at end of file Property changes on: trunk/extensions/Theme/monobook/dark.css ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/extensions/Theme/monobook/pink.css =================================================================== --- trunk/extensions/Theme/monobook/pink.css (rev 0) +++ trunk/extensions/Theme/monobook/pink.css 2011-10-08 17:55:30 UTC (rev 99315) @@ -0,0 +1,200 @@ +/* +** MediaWiki 'Romantic Pink' style sheet for CSS2-capable browsers. +** +** Developed for ShoutWiki <http://www.shoutwiki.com> +** @license GPL (http://www.gnu.org/copyleft/gpl.html) +** @author Jack Phoenix <j...@shoutwiki.com> +** @copyright © 2007-2011 Jack Phoenix <j...@shoutwiki.com> +** @date 14 September 2011 +*/ +div#content { + background: #FFC0CB; + color: black; +} + +body { + background: none !important; + background-color: #FFC0CB !important; +} + +a { + color: #0066FF; +} + +a:visited { + color: #0066FF; +} + +a:active { + color: #faa700; +} + +a.new, #p-personal a.new { + color: #ba0000; +} + +p { + color: #000; +} + +h1 { + border-bottom: 1px solid #FFC0CB; +} + +/* user notification thing */ +.usermessage { + background-color: #ffce7b; + border: 1px solid #ffa500; + color: black; +} + +/* +** content styles +*/ +#toc, +.toc, +.mw-warning { + background-color: #EEC0DC; +} + +/* thumbnails */ +div.thumb { + border-style: solid; + border-color: transparent; +} + +/* Interwiki styling */ +#bodyContent a.extiw, +#bodyContent a.extiw:active { + color: #00CCFF; +} +#bodyContent a.external { + color: #0066FF; +} +/* Added from original Romantic Pink CSS file */ +#bodyContent a.extiw:visited { + color: #0066FF; +} +#bodyContent a.external:visited { + color: #0066FF; +} +#bodyContent a.stub, #bodyContent a.stub:visited { + color: #FFC0CB; +} + +.pBody { + background-color: #FFC0CB; + color: #FFC0CB; +} + +#p-cactions li { + background: none; /* Internet Explorer fix */ +} + +/* @todo FIXME/CHECKME: this looks suspicious */ +#p-cactions li.selected { + background: white; +} + +#p-cactions li.selected a { + background-color: transparent; + padding: 0 1em .2em !important;/* @todo FIXME/CHECKME: this looks suspicious */ +} + +/* +** footer +*/ +div#footer { + background-color: #FFC0CB; + border-bottom: 1px solid #FFC0CB; + border-top: 1px solid #FFC0CB; + color: #000000; + min-height: 39px; + z-index: 2 !important; +} + +/* Classes for EXIF data display */ +table.mw_metadata { + width: 300px; /* @todo CHECKME: still needed? shared.css has 400px */ +} + +/** Special:Version */ +table#sv-ext, table#sv-hooks, table#sv-software { + margin: 1em; + padding: 0em; +} + +#sv-ext td, #sv-hooks td, #sv-software td, +#sv-ext th, #sv-hooks th, #sv-software th { + border: 1px solid #A0A0A0; + padding: 0 0.15em 0 0.15em; +} +#sv-ext th, #sv-hooks th, #sv-software th { + background-color: #F0F0F0; + color: black; + padding: 0 0.15em 0 0.15em; +} +tr.sv-space { + height: 0.8em; + border: none; +} +tr.sv-space td { display: none; } + +/* Begin misc. hacks */ +#bodyContent { + background: none; + background-color: #FFC0CB; + color: #000000; +} + +.selected { + background-color: #333333; + color: #FFC0CB; + border-color: #CCCCCC; +} + +#p-navigation a { + display: inline; +} + +#p-cactions ul li a { + background-color: #FFC0CB; + color: #000000; +} + +/* I have absolutely no idea wtf this crap is */ +div.header-notice, div.warning { + width: 85%; + margin: 1.0em auto 0.5em auto; + padding: 5px; + text-align: left; + border: 1px inset #999999; + background-color: #2A2A2A; + color: #FFFFFF; + line-height: 120%; +} + +div.warning { + color: red !important; + font-weight: bold; +} + +div.notice p, div.warning p { + line-height: 120% !important; +} + +/* +** Diff rendering +*/ +table.diff, td.diff-otitle, td.diff-ntitle { + background-color: transparent; +} + +#pagehistory li .selected { + background-color: transparent; +} + +/* testing a random fix */ +.selected { + color: #000000; +} \ No newline at end of file Property changes on: trunk/extensions/Theme/monobook/pink.css ___________________________________________________________________ Added: svn:eol-style + native _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs