diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
commit | 370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch) | |
tree | 491674f4c242e4d6ba0d04eafa305174c35a3391 /skins | |
parent | f4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff) |
Update auf 1.13.0
Diffstat (limited to 'skins')
48 files changed, 2056 insertions, 1022 deletions
diff --git a/skins/Chick.deps.php b/skins/Chick.deps.php index e49e95e7..a7cb0844 100644 --- a/skins/Chick.deps.php +++ b/skins/Chick.deps.php @@ -3,7 +3,7 @@ // Chick.php is compiled, working around a bug in the APC opcode // cache on PHP 5, where cached code can break if the include order // changed on a subsequent page view. -// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html +// see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html if ( ! defined( 'MEDIAWIKI' ) ) die( 1 ); diff --git a/skins/Chick.php b/skins/Chick.php index 30993b77..cfbdbc7d 100644 --- a/skins/Chick.php +++ b/skins/Chick.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -14,7 +15,7 @@ require_once( dirname(__FILE__) . '/MonoBook.php' ); /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinChick extends SkinTemplate { function initPage( &$out ) { @@ -22,6 +23,7 @@ class SkinChick extends SkinTemplate { $this->skinname = 'chick'; $this->stylename = 'chick'; $this->template = 'MonoBookTemplate'; + $this->fixfiles = array( 'IE50', 'IE55', 'IE60' ); } } diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index f33c34f4..29addfc9 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -11,13 +12,10 @@ if( !defined( 'MEDIAWIKI' ) ) /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinCologneBlue extends Skin { - private $searchboxes = ''; - // How many search boxes have we made? Avoid duplicate id's. - function getStylesheet() { return 'common/cologneblue.css'; } @@ -180,6 +178,9 @@ class SkinCologneBlue extends Skin { # Use the first heading from the Monobook sidebar as the "browse" section $bar = $this->buildSidebar(); + unset( $bar['SEARCH'] ); + unset( $bar['LANGUAGES'] ); + unset( $bar['TOOLBOX'] ); $browseLinks = reset( $bar ); foreach ( $browseLinks as $link ) { diff --git a/skins/Modern.deps.php b/skins/Modern.deps.php index 73adcb40..e76ab997 100644 --- a/skins/Modern.deps.php +++ b/skins/Modern.deps.php @@ -1,13 +1,12 @@ <?php // This file exists to ensure that base classes are preloaded before -// Simple.php is compiled, working around a bug in the APC opcode +// Modern.php is compiled, working around a bug in the APC opcode // cache on PHP 5, where cached code can break if the include order // changed on a subsequent page view. -// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html +// see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html if ( ! defined( 'MEDIAWIKI' ) ) die( 1 ); -require_once( dirname( dirname( __FILE__ ) ) . '/includes/SkinTemplate.php'); -require_once( dirname(__FILE__) . '/Modern.php' ); +require_once( dirname( dirname( __FILE__ ) ) . '/includes/SkinTemplate.php' ); diff --git a/skins/Modern.php b/skins/Modern.php index a8730666..32581b16 100644 --- a/skins/Modern.php +++ b/skins/Modern.php @@ -3,7 +3,8 @@ * Modern skin, derived from monobook template. * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -12,9 +13,18 @@ if( !defined( 'MEDIAWIKI' ) ) /** * Inherit main code from SkinTemplate, set the CSS and template filter. * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinModern extends SkinTemplate { + /* + * We don't like the default getPoweredBy, the icon clashes with the + * skin L&F. + */ + function getPoweredBy() { + global $wgVersion; + return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>"; + } + function initPage( &$out ) { SkinTemplate::initPage( $out ); $this->skinname = 'modern'; @@ -25,9 +35,10 @@ class SkinModern extends SkinTemplate { /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class ModernTemplate extends QuickTemplate { + var $skin; /** * Template filter callback for Modern skin. * Takes an associative array of data set from a SkinTemplate-based @@ -37,8 +48,9 @@ class ModernTemplate extends QuickTemplate { * @access private */ function execute() { - global $wgUser; - $skin = $wgUser->getSkin(); + global $wgRequest; + $this->skin = $skin = $this->data['skin']; + $action = $wgRequest->getText( 'action' ); // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); @@ -52,10 +64,12 @@ class ModernTemplate extends QuickTemplate { <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" /> <?php $this->html('headlinks') ?> <title><?php $this->text('pagetitle') ?></title> +<?php if(empty($this->data['printable']) ) { ?> <style type="text/css" media="screen, projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style> + <?php } ?> <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /> <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]--> @@ -97,12 +111,27 @@ class ModernTemplate extends QuickTemplate { <h5><?php $this->msg('views') ?></h5> <div class="pBody"> <ul> - <?php foreach($this->data['content_actions'] as $key => $tab) { ?> - <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php - if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php } - ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php - echo htmlspecialchars($tab['text']) ?></a></li> - <?php } ?> + <?php foreach($this->data['content_actions'] as $key => $tab) { + echo ' + <li id="ca-' . Sanitizer::escapeId($key).'"'; + if( $tab['class'] ) { + echo ' class="'.htmlspecialchars($tab['class']).'"'; + } + echo'><a href="'.htmlspecialchars($tab['href']).'"'; + # We don't want to give the watch tab an accesskey if the + # page is being edited, because that conflicts with the + # accesskey on the watch checkbox. We also don't want to + # give the edit tab an accesskey, because that's fairly su- + # perfluous and conflicts with an accesskey (Ctrl-E) often + # used for editing in Safari. + if( in_array( $action, array( 'edit', 'submit' ) ) + && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) { + echo $skin->tooltip( "ca-$key" ); + } else { + echo $skin->tooltipAndAccesskey( "ca-$key" ); + } + echo '>'.htmlspecialchars($tab['text']).'</a></li>'; + } ?> </ul> </div> </div> @@ -126,47 +155,114 @@ class ModernTemplate extends QuickTemplate { <div id="contentSub"><?php $this->html('subtitle') ?></div> <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?> - <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?> + <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?> <?php $this->html('bodytext') ?> <div class='mw_clear'></div> - <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?> + <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> </div><!-- mw_contentholder --> </div><!-- mw_content --> </div><!-- mw_contentwrapper --> <div id="mw_portlets"> - <!-- other portlets --> - <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> - <div class='portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>> - <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5> - <div class='pBody'> + <!-- portlets --> + <?php + $sidebar = $this->data['sidebar']; + if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true; + if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true; + if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true; + + foreach ($sidebar as $boxName => $cont) { + if ( $boxName == 'SEARCH' ) { + $this->searchBox(); + } elseif ( $boxName == 'TOOLBOX' ) { + $this->toolbox(); + } elseif ( $boxName == 'LANGUAGES' ) { + $this->languageBox(); + } else { + $this->customBox( $boxName, $cont ); + } + } + ?> + + </div><!-- mw_portlets --> + + + </div><!-- main --> + + <div class="mw_clear"></div> + + <!-- personal portlet --> + <div class="portlet" id="p-personal"> + <h5><?php $this->msg('personaltools') ?></h5> + <div class="pBody"> <ul> -<?php foreach($cont as $key => $val) { ?> - <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php - if ( $val['active'] ) { ?> class="active" <?php } - ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li> +<?php foreach($this->data['personal_urls'] as $key => $item) { ?> + <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php + if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php + echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php + if(!empty($item['class'])) { ?> class="<?php + echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php + echo htmlspecialchars($item['text']) ?></a></li> <?php } ?> </ul> - </div><!-- pBody --> - </div><!-- portlet --> - <?php } ?> + </div> + </div> + + <!-- footer --> + <div id="footer"> + <ul id="f-list"> +<?php + $footerlinks = array( + 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', + 'privacy', 'about', 'disclaimer', 'tagline', + ); + foreach( $footerlinks as $aLink ) { + if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { +?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> +<?php } + } +?> + </ul> + <?php echo $this->html("poweredbyico"); ?> + </div> + + <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> +<?php $this->html('reporttime') ?> +<?php if ( $this->data['debug'] ): ?> +<!-- Debug output: +<?php $this->text( 'debug' ); ?> +--> +<?php endif; ?> +</body></html> +<?php + wfRestoreWarnings(); + } // end of execute() method + + /*************************************************************************************************/ + function searchBox() { +?> <!-- search --> <div id="p-search" class="portlet"> <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5> <div id="searchBody" class="pBody"> <form action="<?php $this->text('searchaction') ?>" id="searchform"><div> - <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search'); + <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search'); if( isset( $this->data['search'] ) ) { ?> value="<?php $this->text('search') ?>"<?php } ?> /> - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> /> - <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> + <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /> + <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> </div></form> </div><!-- pBody --> </div><!-- portlet --> +<?php + } + /*************************************************************************************************/ + function toolbox() { +?> <!-- toolbox --> <div class="portlet" id="p-tb"> <h5><?php $this->msg('toolbox') ?></h5> @@ -176,23 +272,23 @@ class ModernTemplate extends QuickTemplate { if($this->data['notspecialpage']) { ?> <li id="t-whatlinkshere"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li> <?php if( $this->data['nav_urls']['recentchangeslinked'] ) { ?> <li id="t-recentchangeslinked"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li> <?php } } if(isset($this->data['nav_urls']['trackbacklink'])) { ?> <li id="t-trackbacklink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li> <?php } if($this->data['feeds']) { ?> <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) { ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php - echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span> + echo htmlspecialchars($feed['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span> <?php } ?></li><?php } @@ -200,26 +296,32 @@ class ModernTemplate extends QuickTemplate { if($this->data['nav_urls'][$special]) { ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li> <?php } } if(!empty($this->data['nav_urls']['print']['href'])) { ?> <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php } if(!empty($this->data['nav_urls']['permalink']['href'])) { ?> <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?> - <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php + <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php } -?> - </ul> + + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); +?> </ul> </div><!-- pBody --> </div><!-- portlet --> +<?php + } + /*************************************************************************************************/ + function languageBox() { +?> <!-- languages --> <?php if( $this->data['language_urls'] ) { ?> @@ -234,60 +336,33 @@ class ModernTemplate extends QuickTemplate { </ul> </div><!-- pBody --> </div><!-- portlet --> -<?php } ?> - - </div><!-- mw_portlets --> - - - </div><!-- main --> - - <div class="mw_clear"></div> +<?php + } + } - <!-- personal portlet --> - <div class="portlet" id="p-personal"> - <h5><?php $this->msg('personaltools') ?></h5> - <div class="pBody"> + /*************************************************************************************************/ + function customBox( $bar, $cont ) { +?> + <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>> + <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5> + <div class='pBody'> +<?php if ( is_array( $cont ) ) { ?> <ul> -<?php foreach($this->data['personal_urls'] as $key => $item) { ?> - <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php - if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php - echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php - if(!empty($item['class'])) { ?> class="<?php - echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php - echo htmlspecialchars($item['text']) ?></a></li> +<?php foreach($cont as $key => $val) { ?> + <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php + if ( $val['active'] ) { ?> class="active" <?php } + ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li> <?php } ?> </ul> - </div> - </div> - - - <!-- footer --> - <div id="footer"> - <ul id="f-list"> -<?php - $footerlinks = array( - 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', - 'privacy', 'about', 'disclaimer', 'tagline', - ); - foreach( $footerlinks as $aLink ) { - if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { -?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> -<?php } - } +<?php } else { + # allow raw HTML block to be defined by extensions + print $cont; + } ?> - </ul> - </div> - - <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> -<?php $this->html('reporttime') ?> -<?php if ( $this->data['debug'] ): ?> -<!-- Debug output: -<?php $this->text( 'debug' ); ?> ---> -<?php endif; ?> -</body></html> + </div><!-- pBody --> + </div><!-- portlet --> <?php - wfRestoreWarnings(); - } // end of execute() method + } + } // end of class ?> diff --git a/skins/MonoBook.deps.php b/skins/MonoBook.deps.php index f53f1743..dda24e0e 100644 --- a/skins/MonoBook.deps.php +++ b/skins/MonoBook.deps.php @@ -3,7 +3,7 @@ // MonoBook.php is compiled, working around a bug in the APC opcode // cache on PHP 5, where cached code can break if the include order // changed on a subsequent page view. -// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html +// see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html if ( ! defined( 'MEDIAWIKI' ) ) die( 1 ); diff --git a/skins/MonoBook.php b/skins/MonoBook.php index e930a5e7..a0b3157a 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -6,7 +6,8 @@ * dependency on PHPTAL. * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -15,7 +16,7 @@ if( !defined( 'MEDIAWIKI' ) ) /** * Inherit main code from SkinTemplate, set the CSS and template filter. * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinMonoBook extends SkinTemplate { /** Using monobook. */ @@ -24,14 +25,18 @@ class SkinMonoBook extends SkinTemplate { $this->skinname = 'monobook'; $this->stylename = 'monobook'; $this->template = 'MonoBookTemplate'; + # Bug 14520: skins that just include this file shouldn't load nonexis- + # tent CSS fix files. + $this->cssfiles = array( 'IE', 'IE50', 'IE55', 'IE60', 'IE70', 'rtl' ); } } /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class MonoBookTemplate extends QuickTemplate { + var $skin; /** * Template filter callback for MonoBook skin. * Takes an associative array of data set from a SkinTemplate-based @@ -41,8 +46,9 @@ class MonoBookTemplate extends QuickTemplate { * @access private */ function execute() { - global $wgUser; - $skin = $wgUser->getSkin(); + global $wgRequest; + $this->skin = $skin = $this->data['skin']; + $action = $wgRequest->getText( 'action' ); // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); @@ -60,29 +66,29 @@ class MonoBookTemplate extends QuickTemplate { @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style> - <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /> - <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> - <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> - <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> - <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> - <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script> - <meta http-equiv="imagetoolbar" content="no" /><![endif]--> + <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" /> + <?php if( in_array( 'IE50', $skin->cssfiles ) ) { ?><!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> + <?php } if( in_array( 'IE55', $skin->cssfiles ) ) { ?><!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> + <?php } if( in_array( 'IE60', $skin->cssfiles ) ) { ?><!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> + <?php } if( in_array( 'IE70', $skin->cssfiles ) ) { ?><!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]--> + <?php } ?><!--[if lt IE 7]><?php if( in_array( 'IE', $skin->cssfiles ) ) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script> + <?php } ?><meta http-equiv="imagetoolbar" content="no" /><![endif]--> <?php print Skin::makeGlobalVariablesScript( $this->data ); ?> <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script> <!-- Head Scripts --> <?php $this->html('headscripts') ?> -<?php if($this->data['jsvarurl' ]) { ?> - <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script> +<?php if($this->data['jsvarurl']) { ?> + <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script> <?php } ?> -<?php if($this->data['pagecss' ]) { ?> - <style type="text/css"><?php $this->html('pagecss' ) ?></style> +<?php if($this->data['pagecss']) { ?> + <style type="text/css"><?php $this->html('pagecss') ?></style> <?php } - if($this->data['usercss' ]) { ?> - <style type="text/css"><?php $this->html('usercss' ) ?></style> + if($this->data['usercss']) { ?> + <style type="text/css"><?php $this->html('usercss') ?></style> <?php } - if($this->data['userjs' ]) { ?> + if($this->data['userjs']) { ?> <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script> <?php } if($this->data['userjsprev']) { ?> @@ -91,7 +97,7 @@ class MonoBookTemplate extends QuickTemplate { if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?> </head> <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?> -<?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?> +<?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?> class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>"> <div id="globalWrapper"> <div id="column-content"> @@ -107,7 +113,7 @@ class MonoBookTemplate extends QuickTemplate { <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?> <!-- start content --> <?php $this->html('bodytext') ?> - <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?> + <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> <!-- end content --> <div class="visualClear"></div> </div> @@ -118,12 +124,27 @@ class MonoBookTemplate extends QuickTemplate { <h5><?php $this->msg('views') ?></h5> <div class="pBody"> <ul> - <?php foreach($this->data['content_actions'] as $key => $tab) { ?> - <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php - if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php } - ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php - echo htmlspecialchars($tab['text']) ?></a></li> - <?php } ?> + <?php foreach($this->data['content_actions'] as $key => $tab) { + echo ' + <li id="ca-' . Sanitizer::escapeId($key).'"'; + if( $tab['class'] ) { + echo ' class="'.htmlspecialchars($tab['class']).'"'; + } + echo'><a href="'.htmlspecialchars($tab['href']).'"'; + # We don't want to give the watch tab an accesskey if the + # page is being edited, because that conflicts with the + # accesskey on the watch checkbox. We also don't want to + # give the edit tab an accesskey, because that's fairly su- + # perfluous and conflicts with an accesskey (Ctrl-E) often + # used for editing in Safari. + if( in_array( $action, array( 'edit', 'submit' ) ) + && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) { + echo $skin->tooltip( "ca-$key" ); + } else { + echo $skin->tooltipAndAccesskey( "ca-$key" ); + } + echo '>'.htmlspecialchars($tab['text']).'</a></li>'; + } ?> </ul> </div> </div> @@ -148,32 +169,85 @@ class MonoBookTemplate extends QuickTemplate { echo $skin->tooltipAndAccesskey('n-mainpage') ?>></a> </div> <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script> - <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?> - <div class='portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>> - <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5> - <div class='pBody'> - <ul> -<?php foreach($cont as $key => $val) { ?> - <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php - if ( $val['active'] ) { ?> class="active" <?php } - ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li> -<?php } ?> +<?php + $sidebar = $this->data['sidebar']; + if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true; + if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true; + if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true; + foreach ($sidebar as $boxName => $cont) { + if ( $boxName == 'SEARCH' ) { + $this->searchBox(); + } elseif ( $boxName == 'TOOLBOX' ) { + $this->toolbox(); + } elseif ( $boxName == 'LANGUAGES' ) { + $this->languageBox(); + } else { + $this->customBox( $boxName, $cont ); + } + } +?> + </div><!-- end of the left (by default at least) column --> + <div class="visualClear"></div> + <div id="footer"> +<?php + if($this->data['poweredbyico']) { ?> + <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> +<?php } + if($this->data['copyrightico']) { ?> + <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> +<?php } + + // Generate additional footer links +?> + <ul id="f-list"> +<?php + $footerlinks = array( + 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', + 'privacy', 'about', 'disclaimer', 'tagline', + ); + foreach( $footerlinks as $aLink ) { + if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { +?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> +<?php } + } +?> </ul> </div> - </div> - <?php } ?> +</div> +<?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> +<?php $this->html('reporttime') ?> +<?php if ( $this->data['debug'] ): ?> +<!-- Debug output: +<?php $this->text( 'debug' ); ?> + +--> +<?php endif; ?> +</body></html> +<?php + wfRestoreWarnings(); + } // end of execute() method + + /*************************************************************************************************/ + function searchBox() { +?> <div id="p-search" class="portlet"> <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5> <div id="searchBody" class="pBody"> <form action="<?php $this->text('searchaction') ?>" id="searchform"><div> - <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search'); + <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search'); if( isset( $this->data['search'] ) ) { ?> value="<?php $this->text('search') ?>"<?php } ?> /> - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> /> - <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> + <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /> + <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> </div></form> </div> </div> +<?php + } + + /*************************************************************************************************/ + function toolbox() { +?> <div class="portlet" id="p-tb"> <h5><?php $this->msg('toolbox') ?></h5> <div class="pBody"> @@ -182,23 +256,23 @@ class MonoBookTemplate extends QuickTemplate { if($this->data['notspecialpage']) { ?> <li id="t-whatlinkshere"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li> <?php if( $this->data['nav_urls']['recentchangeslinked'] ) { ?> <li id="t-recentchangeslinked"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li> <?php } } if(isset($this->data['nav_urls']['trackbacklink'])) { ?> <li id="t-trackbacklink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li> <?php } if($this->data['feeds']) { ?> <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) { ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php - echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span> + echo htmlspecialchars($feed['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a> </span> <?php } ?></li><?php } @@ -206,29 +280,35 @@ class MonoBookTemplate extends QuickTemplate { if($this->data['nav_urls'][$special]) { ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li> + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li> <?php } } if(!empty($this->data['nav_urls']['print']['href'])) { ?> <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php } if(!empty($this->data['nav_urls']['permalink']['href'])) { ?> <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href']) - ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php + ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?> - <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php + <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php } wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?> </ul> </div> </div> <?php - if( $this->data['language_urls'] ) { ?> + } + + /*************************************************************************************************/ + function languageBox() { + if( $this->data['language_urls'] ) { +?> <div id="p-lang" class="portlet"> <h5><?php $this->msg('otherlanguages') ?></h5> <div class="pBody"> @@ -240,47 +320,34 @@ class MonoBookTemplate extends QuickTemplate { </ul> </div> </div> -<?php } ?> - </div><!-- end of the left (by default at least) column --> - <div class="visualClear"></div> - <div id="footer"> <?php - if($this->data['poweredbyico']) { ?> - <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div> -<?php } - if($this->data['copyrightico']) { ?> - <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div> -<?php } + } + } - // Generate additional footer links + /*************************************************************************************************/ + function customBox( $bar, $cont ) { ?> - <ul id="f-list"> -<?php - $footerlinks = array( - 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', - 'privacy', 'about', 'disclaimer', 'tagline', - ); - foreach( $footerlinks as $aLink ) { - if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) { -?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li> -<?php } + <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>> + <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5> + <div class='pBody'> +<?php if ( is_array( $cont ) ) { ?> + <ul> +<?php foreach($cont as $key => $val) { ?> + <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php + if ( $val['active'] ) { ?> class="active" <?php } + ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li> +<?php } ?> + </ul> +<?php } else { + # allow raw HTML block to be defined by extensions + print $cont; } ?> - </ul> </div> - - <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?> -</div> -<?php $this->html('reporttime') ?> -<?php if ( $this->data['debug'] ): ?> -<!-- Debug output: -<?php $this->text( 'debug' ); ?> - ---> -<?php endif; ?> -</body></html> + </div> <?php - wfRestoreWarnings(); - } // end of execute() method + } + } // end of class -?> + + diff --git a/skins/MySkin.deps.php b/skins/MySkin.deps.php index 5e24906d..b589cc52 100644 --- a/skins/MySkin.deps.php +++ b/skins/MySkin.deps.php @@ -3,7 +3,7 @@ // MySkin.php is compiled, working around a bug in the APC opcode // cache on PHP 5, where cached code can break if the include order // changed on a subsequent page view. -// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html +// see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html if ( ! defined( 'MEDIAWIKI' ) ) die( 1 ); diff --git a/skins/MySkin.php b/skins/MySkin.php index 837df959..90fb5349 100644 --- a/skins/MySkin.php +++ b/skins/MySkin.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -14,7 +15,7 @@ require_once( dirname(__FILE__) . '/MonoBook.php' ); /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinMySkin extends SkinTemplate { function initPage( &$out ) { diff --git a/skins/Nostalgia.php b/skins/Nostalgia.php index 8759659e..a7eae66d 100644 --- a/skins/Nostalgia.php +++ b/skins/Nostalgia.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -11,7 +12,7 @@ if( !defined( 'MEDIAWIKI' ) ) /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinNostalgia extends Skin { diff --git a/skins/Simple.deps.php b/skins/Simple.deps.php index 7603f522..99fadc6d 100644 --- a/skins/Simple.deps.php +++ b/skins/Simple.deps.php @@ -3,7 +3,7 @@ // Simple.php is compiled, working around a bug in the APC opcode // cache on PHP 5, where cached code can break if the include order // changed on a subsequent page view. -// see http://mail.wikipedia.org/pipermail/wikitech-l/2006-January/033660.html +// see http://lists.wikimedia.org/pipermail/wikitech-l/2006-January/021311.html if ( ! defined( 'MEDIAWIKI' ) ) die( 1 ); diff --git a/skins/Simple.php b/skins/Simple.php index b61b6a94..db64e48b 100644 --- a/skins/Simple.php +++ b/skins/Simple.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -14,7 +15,7 @@ require_once( dirname(__FILE__) . '/MonoBook.php' ); /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinSimple extends SkinTemplate { function initPage( &$out ) { @@ -22,6 +23,7 @@ class SkinSimple extends SkinTemplate { $this->skinname = 'simple'; $this->stylename = 'simple'; $this->template = 'MonoBookTemplate'; + $this->cssfiles = array( 'rtl' ); } function reallyDoGetUserStyles() { diff --git a/skins/Standard.php b/skins/Standard.php index ed00d59d..87a151fa 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -1,9 +1,10 @@ <?php /** - * See skin.txt + * See docs/skin.txt * * @todo document - * @addtogroup Skins + * @file + * @ingroup Skins */ if( !defined( 'MEDIAWIKI' ) ) @@ -11,7 +12,7 @@ if( !defined( 'MEDIAWIKI' ) ) /** * @todo document - * @addtogroup Skins + * @ingroup Skins */ class SkinStandard extends Skin { @@ -152,6 +153,9 @@ class SkinStandard extends Skin { # Use the first heading from the Monobook sidebar as the "browse" section $bar = $this->buildSidebar(); + unset( $bar['SEARCH'] ); + unset( $bar['LANGUAGES'] ); + unset( $bar['TOOLBOX'] ); $browseLinks = reset( $bar ); foreach ( $browseLinks as $link ) { diff --git a/skins/chick/main.css b/skins/chick/main.css index 07b922c3..9ba97920 100644 --- a/skins/chick/main.css +++ b/skins/chick/main.css @@ -198,14 +198,14 @@ span.subpages { display: block; } color: red; font-size: larger; } -#catlinks { +.catlinks { border:1px solid #aaaaaa; background-color:#f9f9f9; padding: 2px 5px; margin: 0.1em 0 0 0; clear: both; } -p.catlinks { margin: 0; padding: 0; } +.catlinks { margin: 0; padding: 0; } /* currently unused, intended to be used by a metadata box @@ -349,30 +349,6 @@ table.rimage { padding:5px; font-size: 95%; } -div.townBox { - position:relative; - float:right; - background:White; - margin-left:1em; - border: 1px solid gray; - padding:0.3em; - width: 200px; - overflow: hidden; - clear: right; -} -div.townBox dl { - padding: 0; - margin: 0 0 0.3em 0; - font-size: 96%; -} -div.townBox dl dt { - background: none; - margin: 0.4em 0 0 0; -} -div.townBox dl dd { - margin: 0.1em 0 0 1.1em; - background-color: #f3f3f3; -} /* ** edit views etc @@ -383,26 +359,9 @@ div.townBox dl dd { padding: 0; } -/* Page history styling */ -/* the auto-generated edit comments */ -.autocomment { color: gray; } -#pagehistory span.user { - margin-left: 1.4em; - margin-right: 0.4em; -} -#pagehistory span.minor { font-weight: bold; } -#pagehistory li { border: 1px solid White; } -#pagehistory li.selected { - background-color:#f9f9f9; - border:1px dashed #aaaaaa; -} - a.external { color: #3366bb; } - div#footer { text-align: center; } - ul#f-list li { list-style: none; text-align: center; } - div.portlet { margin: 0.5em 0; } .redirectText { diff --git a/skins/common/allmessages.js b/skins/common/allmessages.js new file mode 100644 index 00000000..9f07a481 --- /dev/null +++ b/skins/common/allmessages.js @@ -0,0 +1,83 @@ +var allmessages_nodelist = false; +var allmessages_modified = false; +var allmessages_timeout = false; +var allmessages_running = false; + +function allmessagesmodified() { + allmessages_modified = !allmessages_modified; + allmessagesfilter(); +} + +function allmessagesfilter() { + if ( allmessages_timeout ) + window.clearTimeout( allmessages_timeout ); + + if ( !allmessages_running ) + allmessages_timeout = window.setTimeout( 'allmessagesfilter_do();', 500 ); +} + +function allmessagesfilter_do() { + if ( !allmessages_nodelist ) + return; + + var text = document.getElementById('allmessagesinput').value.toLowerCase(); + var nodef = allmessages_modified; + + allmessages_running = true; + + for ( var name in allmessages_nodelist ) { + var nodes = allmessages_nodelist[name]; + var display = ( name.toLowerCase().indexOf( text ) == -1 ? 'none' : '' ); + + for ( var i = 0; i < nodes.length; i++) + nodes[i].style.display = + ( nodes[i].className == "def" && nodef + ? 'none' : display ); + } + + if ( text != document.getElementById('allmessagesinput').value.toLowerCase() || + nodef != allmessages_modified ) + allmessagesfilter_do(); // repeat + + allmessages_running = false; +} + +function allmessagesfilter_init() { + if ( allmessages_nodelist ) + return; + + var nodelist = new Array(); + var templist = new Array(); + + var table = document.getElementById('allmessagestable'); + if ( !table ) return; + + var rows = document.getElementsByTagName('tr'); + for ( var i = 0; i < rows.length; i++ ) { + var id = rows[i].getAttribute('id') + if ( id && id.substring(0,16) != 'sp-allmessages-r' ) continue; + templist[ id ] = rows[i]; + } + + var spans = table.getElementsByTagName('span'); + for ( var i = 0; i < spans.length; i++ ) { + var id = spans[i].getAttribute('id') + if ( id && id.substring(0,17) != 'sp-allmessages-i-' ) continue; + if ( !spans[i].firstChild || spans[i].firstChild.nodeType != 3 ) continue; + + var nodes = new Array(); + var row1 = templist[ id.replace('i', 'r1') ]; + var row2 = templist[ id.replace('i', 'r2') ]; + + if ( row1 ) nodes[nodes.length] = row1; + if ( row2 ) nodes[nodes.length] = row2; + nodelist[ spans[i].firstChild.nodeValue ] = nodes; + } + + var k = document.getElementById('allmessagesfilter'); + if (k) { k.style.display = ''; } + + allmessages_nodelist = nodelist; +} + +hookEvent( "load", allmessagesfilter_init ); diff --git a/skins/common/commonPrint.css b/skins/common/commonPrint.css index b0aad3d1..ecf146de 100644 --- a/skins/common/commonPrint.css +++ b/skins/common/commonPrint.css @@ -209,31 +209,6 @@ img { border: none; } img.tex { vertical-align: middle; } span.texhtml { font-family: serif; } -div.townBox { - position:relative; - float:right; - background:White; - margin-left:1em; - border: 1px solid gray; - padding:0.3em; - width: 200px; - overflow: hidden; - clear: right; -} -div.townBox dl { - padding: 0; - margin: 0 0 0.3em 0; - font-size: 96%; -} -div.townBox dl dt { - background: none; - margin: 0.4em 0 0 0; -} -div.townBox dl dd { - margin: 0.1em 0 0 1.1em; - background-color: #f3f3f3; -} - #siteNotice { display: none; } table.gallery { diff --git a/skins/common/common_rtl.css b/skins/common/common_rtl.css index d26acc13..cda3835d 100644 --- a/skins/common/common_rtl.css +++ b/skins/common/common_rtl.css @@ -14,7 +14,7 @@ fieldset.operaprefsection { margin-right: 18em; } /* page history */ -#pagehistory span.user { +#pagehistory .history-user { margin-right: 1.4em; margin-left: 0.4em; } @@ -28,10 +28,20 @@ div.tright, div.floatright { div.tleft, div.floatleft { clear: left; } -/* Unblock and Ipblocklist links of Special:Blockip */ -p.mw-ipb-conveniencelinks { +/* Convenience links to edit block and delete reasons */ +p.mw-ipb-conveniencelinks, p.mw-filedelete-editreasons, p.mw-delete-editreasons { float: left; } table.filehistory th { text-align: right; } + +/** + * Lists: + * The following lines don't have a visible effect on non-Gecko browsers + * They fix a problem ith Gecko browsers rendering lists to the right of + * left-floated objects in an RTL layout. + */ +html > body div#article ul { + display: table; +} diff --git a/skins/common/diff.css b/skins/common/diff.css index 6a1f23b5..b262222a 100644 --- a/skins/common/diff.css +++ b/skins/common/diff.css @@ -33,6 +33,8 @@ td.diff-context { color: red; font-weight: bold; text-decoration: none; + white-space: pre-wrap; + white-space: -moz-pre-wrap; } table.diff { diff --git a/skins/common/edit.js b/skins/common/edit.js new file mode 100644 index 00000000..945059e0 --- /dev/null +++ b/skins/common/edit.js @@ -0,0 +1,156 @@ +// this function generates the actual toolbar buttons with localized text +// we use it to avoid creating the toolbar where javascript is not enabled +function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) { + // Don't generate buttons for browsers which don't fully + // support it. + mwEditButtons[mwEditButtons.length] = + {"imageId": imageId, + "imageFile": imageFile, + "speedTip": speedTip, + "tagOpen": tagOpen, + "tagClose": tagClose, + "sampleText": sampleText}; +} + +// this function generates the actual toolbar buttons with localized text +// we use it to avoid creating the toolbar where javascript is not enabled +function mwInsertEditButton(parent, item) { + var image = document.createElement("img"); + image.width = 23; + image.height = 22; + image.className = "mw-toolbar-editbutton"; + if (item.imageId) image.id = item.imageId; + image.src = item.imageFile; + image.border = 0; + image.alt = item.speedTip; + image.title = item.speedTip; + image.style.cursor = "pointer"; + image.onclick = function() { + insertTags(item.tagOpen, item.tagClose, item.sampleText); + return false; + }; + + parent.appendChild(image); + return true; +} + +function mwSetupToolbar() { + var toolbar = document.getElementById('toolbar'); + if (!toolbar) { return false; } + + var textbox = document.getElementById('wpTextbox1'); + if (!textbox) { return false; } + + // Don't generate buttons for browsers which don't fully + // support it. + if (!(document.selection && document.selection.createRange) + && textbox.selectionStart === null) { + return false; + } + + for (var i = 0; i < mwEditButtons.length; i++) { + mwInsertEditButton(toolbar, mwEditButtons[i]); + } + for (var i = 0; i < mwCustomEditButtons.length; i++) { + mwInsertEditButton(toolbar, mwCustomEditButtons[i]); + } + return true; +} + +// apply tagOpen/tagClose to selection in textarea, +// use sampleText instead of selection if there is none +function insertTags(tagOpen, tagClose, sampleText) { + var txtarea; + if (document.editform) { + txtarea = document.editform.wpTextbox1; + } else { + // some alternate form? take the first one we can find + var areas = document.getElementsByTagName('textarea'); + txtarea = areas[0]; + } + var selText, isSample = false; + + if (document.selection && document.selection.createRange) { // IE/Opera + + //save window scroll position + if (document.documentElement && document.documentElement.scrollTop) + var winScroll = document.documentElement.scrollTop + else if (document.body) + var winScroll = document.body.scrollTop; + //get current selection + txtarea.focus(); + var range = document.selection.createRange(); + selText = range.text; + //insert tags + checkSelectedText(); + range.text = tagOpen + selText + tagClose; + //mark sample text as selected + if (isSample && range.moveStart) { + if (window.opera) + tagClose = tagClose.replace(/\n/g,''); + range.moveStart('character', - tagClose.length - selText.length); + range.moveEnd('character', - tagClose.length); + } + range.select(); + //restore window scroll position + if (document.documentElement && document.documentElement.scrollTop) + document.documentElement.scrollTop = winScroll + else if (document.body) + document.body.scrollTop = winScroll; + + } else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla + + //save textarea scroll position + var textScroll = txtarea.scrollTop; + //get current selection + txtarea.focus(); + var startPos = txtarea.selectionStart; + var endPos = txtarea.selectionEnd; + selText = txtarea.value.substring(startPos, endPos); + //insert tags + checkSelectedText(); + txtarea.value = txtarea.value.substring(0, startPos) + + tagOpen + selText + tagClose + + txtarea.value.substring(endPos, txtarea.value.length); + //set new selection + if (isSample) { + txtarea.selectionStart = startPos + tagOpen.length; + txtarea.selectionEnd = startPos + tagOpen.length + selText.length; + } else { + txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; + txtarea.selectionEnd = txtarea.selectionStart; + } + //restore textarea scroll position + txtarea.scrollTop = textScroll; + } + + function checkSelectedText(){ + if (!selText) { + selText = sampleText; + isSample = true; + } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char + selText = selText.substring(0, selText.length - 1); + tagClose += ' ' + } + } + +} + +/** + * Restore the edit box scroll state following a preview operation, + * and set up a form submission handler to remember this state + */ +function scrollEditBox() { + var editBox = document.getElementById( 'wpTextbox1' ); + var scrollTop = document.getElementById( 'wpScrolltop' ); + var editForm = document.getElementById( 'editform' ); + if( editBox && scrollTop ) { + if( scrollTop.value ) + editBox.scrollTop = scrollTop.value; + addHandler( editForm, 'submit', function() { + document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; + } ); + } +} +hookEvent( 'load', scrollEditBox ); +hookEvent( 'load', mwSetupToolbar ); diff --git a/skins/common/history.js b/skins/common/history.js new file mode 100644 index 00000000..57e61849 --- /dev/null +++ b/skins/common/history.js @@ -0,0 +1,83 @@ +function historyRadios(parent) { + var inputs = parent.getElementsByTagName('input'); + var radios = []; + for (var i = 0; i < inputs.length; i++) { + if (inputs[i].name == "diff" || inputs[i].name == "oldid") { + radios[radios.length] = inputs[i]; + } + } + return radios; +} + +// check selection and tweak visibility/class onclick +function diffcheck() { + var dli = false; // the li where the diff radio is checked + var oli = false; // the li where the oldid radio is checked + var hf = document.getElementById('pagehistory'); + if (!hf) { + return true; + } + var lis = hf.getElementsByTagName('li'); + for (var i=0;i<lis.length;i++) { + var inputs = historyRadios(lis[i]); + if (inputs[1] && inputs[0]) { + if (inputs[1].checked || inputs[0].checked) { // this row has a checked radio button + if (inputs[1].checked && inputs[0].checked && inputs[0].value == inputs[1].value) { + return false; + } + if (oli) { // it's the second checked radio + if (inputs[1].checked) { + oli.className = "selected"; + return false; + } + } else if (inputs[0].checked) { + return false; + } + if (inputs[0].checked) { + dli = lis[i]; + } + if (!oli) { + inputs[0].style.visibility = 'hidden'; + } + if (dli) { + inputs[1].style.visibility = 'hidden'; + } + lis[i].className = "selected"; + oli = lis[i]; + } else { // no radio is checked in this row + if (!oli) { + inputs[0].style.visibility = 'hidden'; + } else { + inputs[0].style.visibility = 'visible'; + } + if (dli) { + inputs[1].style.visibility = 'hidden'; + } else { + inputs[1].style.visibility = 'visible'; + } + lis[i].className = ""; + } + } + } + return true; +} + +// page history stuff +// attach event handlers to the input elements on history page +function histrowinit() { + var hf = document.getElementById('pagehistory'); + if (!hf) { + return; + } + var lis = hf.getElementsByTagName('li'); + for (var i = 0; i < lis.length; i++) { + var inputs = historyRadios(lis[i]); + if (inputs[0] && inputs[1]) { + inputs[0].onclick = diffcheck; + inputs[1].onclick = diffcheck; + } + } + diffcheck(); +} + +hookEvent("load", histrowinit); diff --git a/skins/common/images/ar/button_bold.png b/skins/common/images/ar/button_bold.png Binary files differnew file mode 100644 index 00000000..93b1783c --- /dev/null +++ b/skins/common/images/ar/button_bold.png diff --git a/skins/common/images/ar/button_headline.png b/skins/common/images/ar/button_headline.png Binary files differnew file mode 100644 index 00000000..3cf2a706 --- /dev/null +++ b/skins/common/images/ar/button_headline.png diff --git a/skins/common/images/ar/button_italic.png b/skins/common/images/ar/button_italic.png Binary files differnew file mode 100644 index 00000000..0421846d --- /dev/null +++ b/skins/common/images/ar/button_italic.png diff --git a/skins/common/images/ar/button_link.png b/skins/common/images/ar/button_link.png Binary files differnew file mode 100644 index 00000000..ed66a7f6 --- /dev/null +++ b/skins/common/images/ar/button_link.png diff --git a/skins/common/images/ar/button_nowiki.png b/skins/common/images/ar/button_nowiki.png Binary files differnew file mode 100644 index 00000000..97d0585a --- /dev/null +++ b/skins/common/images/ar/button_nowiki.png diff --git a/skins/common/images/be-tarask/button_bold.png b/skins/common/images/be-tarask/button_bold.png Binary files differnew file mode 100644 index 00000000..f662c76c --- /dev/null +++ b/skins/common/images/be-tarask/button_bold.png diff --git a/skins/common/images/be-tarask/button_italic.png b/skins/common/images/be-tarask/button_italic.png Binary files differnew file mode 100644 index 00000000..88e1b3bb --- /dev/null +++ b/skins/common/images/be-tarask/button_italic.png diff --git a/skins/common/images/be-tarask/button_link.png b/skins/common/images/be-tarask/button_link.png Binary files differnew file mode 100644 index 00000000..f68d5d56 --- /dev/null +++ b/skins/common/images/be-tarask/button_link.png diff --git a/skins/common/images/cyrl/LICENSE b/skins/common/images/cyrl/LICENSE new file mode 100644 index 00000000..bedcec66 --- /dev/null +++ b/skins/common/images/cyrl/LICENSE @@ -0,0 +1,17 @@ +button_bold.png +--------------- +Source : http://commons.wikimedia.org/wiki/Image:Button_bold_ukr.png +License: Public domain +Author : Alexey Belomoev + +button_italic.png +------------------------ +Source : http://commons.wikimedia.org/wiki/Image:Button_italic_ukr.png +License: Public domain +Author : Alexey Belomoev + +button_link.png +----------------- +Source : http://commons.wikimedia.org/wiki/Image:Button_internal_link_ukr.png +License: GPL +Author : Saproj, Erik Möller diff --git a/skins/common/images/cyrl/button_bold.png b/skins/common/images/cyrl/button_bold.png Binary files differnew file mode 100644 index 00000000..1c932f85 --- /dev/null +++ b/skins/common/images/cyrl/button_bold.png diff --git a/skins/common/images/cyrl/button_italic.png b/skins/common/images/cyrl/button_italic.png Binary files differnew file mode 100644 index 00000000..f5e588ec --- /dev/null +++ b/skins/common/images/cyrl/button_italic.png diff --git a/skins/common/images/cyrl/button_link.png b/skins/common/images/cyrl/button_link.png Binary files differnew file mode 100644 index 00000000..a690cb35 --- /dev/null +++ b/skins/common/images/cyrl/button_link.png diff --git a/skins/common/images/spinner.gif b/skins/common/images/spinner.gif Binary files differindex 57d749b0..bdd59d52 100644 --- a/skins/common/images/spinner.gif +++ b/skins/common/images/spinner.gif diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js new file mode 100644 index 00000000..52470060 --- /dev/null +++ b/skins/common/mwsuggest.js @@ -0,0 +1,775 @@ +/* + * OpenSearch ajax suggestion engine for MediaWiki + * + * uses core MediaWiki open search support to fetch suggestions + * and show them below search boxes and other inputs + * + * by Robert Stojnic (April 2008) + */ + +// search_box_id -> Results object +var os_map = {}; +// cached data, url -> json_text +var os_cache = {}; +// global variables for suggest_keypress +var os_cur_keypressed = 0; +var os_last_keypress = 0; +var os_keypressed_count = 0; +// type: Timer +var os_timer = null; +// tie mousedown/up events +var os_mouse_pressed = false; +var os_mouse_num = -1; +// if true, the last change was made by mouse (and not keyboard) +var os_mouse_moved = false; +// delay between keypress and suggestion (in ms) +var os_search_timeout = 250; +// these pairs of inputs/forms will be autoloaded at startup +var os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'); +var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' ); +// if we stopped the service +var os_is_stopped = false; +// max lines to show in suggest table +var os_max_lines_per_suggest = 7; + +/** Timeout timer class that will fetch the results */ +function os_Timer(id,r,query){ + this.id = id; + this.r = r; + this.query = query; +} + +/** Property class for single search box */ +function os_Results(name, formname){ + this.searchform = formname; // id of the searchform + this.searchbox = name; // id of the searchbox + this.container = name+"Suggest"; // div that holds results + this.resultTable = name+"Result"; // id base for the result table (+num = table row) + this.resultText = name+"ResultText"; // id base for the spans within result tables (+num) + this.toggle = name+"Toggle"; // div that has the toggle (enable/disable) link + this.query = null; // last processed query + this.results = null; // parsed titles + this.resultCount = 0; // number of results + this.original = null; // query that user entered + this.selected = -1; // which result is selected + this.containerCount = 0; // number of results visible in container + this.containerRow = 0; // height of result field in the container + this.containerTotal = 0; // total height of the container will all results + this.visible = false; // if container is visible +} + +/** Hide results div */ +function os_hideResults(r){ + var c = document.getElementById(r.container); + if(c != null) + c.style.visibility = "hidden"; + r.visible = false; + r.selected = -1; +} + +/** Show results div */ +function os_showResults(r){ + if(os_is_stopped) + return; + os_fitContainer(r); + var c = document.getElementById(r.container); + r.selected = -1; + if(c != null){ + c.scrollTop = 0; + c.style.visibility = "visible"; + r.visible = true; + } +} + +function os_operaWidthFix(x){ + // TODO: better css2 incompatibility detection here + if(is_opera || is_khtml || navigator.userAgent.toLowerCase().indexOf('firefox/1')!=-1){ + return x - 30; // opera&konqueror & old firefox don't understand overflow-x, estimate scrollbar width + } + return x; +} + +function os_encodeQuery(value){ + if (encodeURIComponent) { + return encodeURIComponent(value); + } + if(escape) { + return escape(value); + } + return null; +} +function os_decodeValue(value){ + if (decodeURIComponent) { + return decodeURIComponent(value); + } + if(unescape){ + return unescape(value); + } + return null; +} + +/** Brower-dependent functions to find window inner size, and scroll status */ +function f_clientWidth() { + return f_filterResults ( + window.innerWidth ? window.innerWidth : 0, + document.documentElement ? document.documentElement.clientWidth : 0, + document.body ? document.body.clientWidth : 0 + ); +} +function f_clientHeight() { + return f_filterResults ( + window.innerHeight ? window.innerHeight : 0, + document.documentElement ? document.documentElement.clientHeight : 0, + document.body ? document.body.clientHeight : 0 + ); +} +function f_scrollLeft() { + return f_filterResults ( + window.pageXOffset ? window.pageXOffset : 0, + document.documentElement ? document.documentElement.scrollLeft : 0, + document.body ? document.body.scrollLeft : 0 + ); +} +function f_scrollTop() { + return f_filterResults ( + window.pageYOffset ? window.pageYOffset : 0, + document.documentElement ? document.documentElement.scrollTop : 0, + document.body ? document.body.scrollTop : 0 + ); +} +function f_filterResults(n_win, n_docel, n_body) { + var n_result = n_win ? n_win : 0; + if (n_docel && (!n_result || (n_result > n_docel))) + n_result = n_docel; + return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; +} + +/** Get the height available for the results container */ +function os_availableHeight(r){ + var absTop = document.getElementById(r.container).style.top; + var px = absTop.lastIndexOf("px"); + if(px > 0) + absTop = absTop.substring(0,px); + return f_clientHeight() - (absTop - f_scrollTop()); +} + + +/** Get element absolute position {left,top} */ +function os_getElementPosition(elemID){ + var offsetTrail = document.getElementById(elemID); + var offsetLeft = 0; + var offsetTop = 0; + while (offsetTrail){ + offsetLeft += offsetTrail.offsetLeft; + offsetTop += offsetTrail.offsetTop; + offsetTrail = offsetTrail.offsetParent; + } + if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){ + offsetLeft += document.body.leftMargin; + offsetTop += document.body.topMargin; + } + return {left:offsetLeft,top:offsetTop}; +} + +/** Create the container div that will hold the suggested titles */ +function os_createContainer(r){ + var c = document.createElement("div"); + var s = document.getElementById(r.searchbox); + var pos = os_getElementPosition(r.searchbox); + var left = pos.left; + var top = pos.top + s.offsetHeight; + c.className = "os-suggest"; + c.setAttribute("id", r.container); + document.body.appendChild(c); + + // dynamically generated style params + // IE workaround, cannot explicitely set "style" attribute + c = document.getElementById(r.container); + c.style.top = top+"px"; + c.style.left = left+"px"; + c.style.width = s.offsetWidth+"px"; + + // mouse event handlers + c.onmouseover = function(event) { os_eventMouseover(r.searchbox, event); }; + c.onmousemove = function(event) { os_eventMousemove(r.searchbox, event); }; + c.onmousedown = function(event) { return os_eventMousedown(r.searchbox, event); }; + c.onmouseup = function(event) { os_eventMouseup(r.searchbox, event); }; + return c; +} + +/** change container height to fit to screen */ +function os_fitContainer(r){ + var c = document.getElementById(r.container); + var h = os_availableHeight(r) - 20; + var inc = r.containerRow; + h = parseInt(h/inc) * inc; + if(h < (2 * inc) && r.resultCount > 1) // min: two results + h = 2 * inc; + if((h/inc) > os_max_lines_per_suggest ) + h = inc * os_max_lines_per_suggest; + if(h < r.containerTotal){ + c.style.height = h +"px"; + r.containerCount = parseInt(Math.round(h/inc)); + } else{ + c.style.height = r.containerTotal+"px"; + r.containerCount = r.resultCount; + } +} +/** If some entries are longer than the box, replace text with "..." */ +function os_trimResultText(r){ + var w = document.getElementById(r.container).offsetWidth; + if(r.containerCount < r.resultCount){ + w -= 20; // give 20px for scrollbar + } else + w = os_operaWidthFix(w); + if(w < 10) + return; + for(var i=0;i<r.resultCount;i++){ + var e = document.getElementById(r.resultText+i); + var replace = 1; + var lastW = e.offsetWidth+1; + var iteration = 0; + var changedText = false; + while(e.offsetWidth > w && (e.offsetWidth < lastW || iteration<2)){ + changedText = true; + lastW = e.offsetWidth; + var l = e.innerHTML; + e.innerHTML = l.substring(0,l.length-replace)+"..."; + iteration++; + replace = 4; // how many chars to replace + } + if(changedText){ + // show hint for trimmed titles + document.getElementById(r.resultTable+i).setAttribute("title",r.results[i]); + } + } +} + +/** Handles data from XMLHttpRequest, and updates the suggest results */ +function os_updateResults(r, query, text, cacheKey){ + os_cache[cacheKey] = text; + r.query = query; + r.original = query; + if(text == ""){ + r.results = null; + r.resultCount = 0; + os_hideResults(r); + } else{ + try { + var p = eval('('+text+')'); // simple json parse, could do a safer one + if(p.length<2 || p[1].length == 0){ + r.results = null; + r.resultCount = 0; + os_hideResults(r); + return; + } + var c = document.getElementById(r.container); + if(c == null) + c = os_createContainer(r); + c.innerHTML = os_createResultTable(r,p[1]); + // init container table sizes + var t = document.getElementById(r.resultTable); + r.containerTotal = t.offsetHeight; + r.containerRow = t.offsetHeight / r.resultCount; + os_trimResultText(r); + os_showResults(r); + } catch(e){ + // bad response from server or such + os_hideResults(r); + os_cache[cacheKey] = null; + } + } +} + +/** Create the result table to be placed in the container div */ +function os_createResultTable(r, results){ + var c = document.getElementById(r.container); + var width = os_operaWidthFix(c.offsetWidth); + var html = "<table class=\"os-suggest-results\" id=\""+r.resultTable+"\" style=\"width: "+width+"px;\">"; + r.results = new Array(); + r.resultCount = results.length; + for(i=0;i<results.length;i++){ + var title = os_decodeValue(results[i]); + r.results[i] = title; + html += "<tr><td class=\"os-suggest-result\" id=\""+r.resultTable+i+"\"><span id=\""+r.resultText+i+"\">"+title+"</span></td></tr>"; + } + html+="</table>" + return html; +} + +/** Fetch namespaces from checkboxes or hidden fields in the search form, + if none defined use wgSearchNamespaces global */ +function os_getNamespaces(r){ + var namespaces = ""; + var elements = document.forms[r.searchform].elements; + for(i=0; i < elements.length; i++){ + var name = elements[i].name; + if(typeof name != 'undefined' && name.length > 2 + && name[0]=='n' && name[1]=='s' + && ((elements[i].type=='checkbox' && elements[i].checked) + || (elements[i].type=='hidden' && elements[i].value=="1")) ){ + if(namespaces!="") + namespaces+="|"; + namespaces+=name.substring(2); + } + } + if(namespaces == "") + namespaces = wgSearchNamespaces.join("|"); + return namespaces; +} + +/** Update results if user hasn't already typed something else */ +function os_updateIfRelevant(r, query, text, cacheKey){ + var t = document.getElementById(r.searchbox); + if(t != null && t.value == query){ // check if response is still relevant + os_updateResults(r, query, text, cacheKey); + } + r.query = query; +} + +/** Fetch results after some timeout */ +function os_delayedFetch(){ + if(os_timer == null) + return; + var r = os_timer.r; + var query = os_timer.query; + os_timer = null; + var path = wgMWSuggestTemplate.replace("{namespaces}",os_getNamespaces(r)) + .replace("{dbname}",wgDBname) + .replace("{searchTerms}",os_encodeQuery(query)); + + // try to get from cache, if not fetch using ajax + var cached = os_cache[path]; + if(cached != null){ + os_updateIfRelevant(r, query, cached, path); + } else{ + var xmlhttp = sajax_init_object(); + if(xmlhttp){ + try { + xmlhttp.open("GET", path, true); + xmlhttp.onreadystatechange=function(){ + if (xmlhttp.readyState==4 && typeof os_updateIfRelevant == 'function') { + os_updateIfRelevant(r, query, xmlhttp.responseText, path); + } + }; + xmlhttp.send(null); + } catch (e) { + if (window.location.hostname == "localhost") { + alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); + } + throw e; + } + } + } +} + +/** Init timed update via os_delayedUpdate() */ +function os_fetchResults(r, query, timeout){ + if(query == ""){ + os_hideResults(r); + return; + } else if(query == r.query) + return; // no change + + os_is_stopped = false; // make sure we're running + + /* var cacheKey = wgDBname+":"+query; + var cached = os_cache[cacheKey]; + if(cached != null){ + os_updateResults(r,wgDBname,query,cached); + return; + } */ + + // cancel any pending fetches + if(os_timer != null && os_timer.id != null) + clearTimeout(os_timer.id); + // schedule delayed fetching of results + if(timeout != 0){ + os_timer = new os_Timer(setTimeout("os_delayedFetch()",timeout),r,query); + } else{ + os_timer = new os_Timer(null,r,query); + os_delayedFetch(); // do it now! + } + +} +/** Change the highlighted row (i.e. suggestion), from position cur to next */ +function os_changeHighlight(r, cur, next, updateSearchBox){ + if (next >= r.resultCount) + next = r.resultCount-1; + if (next < -1) + next = -1; + r.selected = next; + if (cur == next) + return; // nothing to do. + + if(cur >= 0){ + var curRow = document.getElementById(r.resultTable + cur); + if(curRow != null) + curRow.className = "os-suggest-result"; + } + var newText; + if(next >= 0){ + var nextRow = document.getElementById(r.resultTable + next); + if(nextRow != null) + nextRow.className = os_HighlightClass(); + newText = r.results[next]; + } else + newText = r.original; + + // adjust the scrollbar if any + if(r.containerCount < r.resultCount){ + var c = document.getElementById(r.container); + var vStart = c.scrollTop / r.containerRow; + var vEnd = vStart + r.containerCount; + if(next < vStart) + c.scrollTop = next * r.containerRow; + else if(next >= vEnd) + c.scrollTop = (next - r.containerCount + 1) * r.containerRow; + } + + // update the contents of the search box + if(updateSearchBox){ + os_updateSearchQuery(r,newText); + } +} + +function os_HighlightClass() { + var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); + if (match) { + var webKitVersion = parseInt(match[1]); + if (webKitVersion < 523) { + // CSS system highlight colors broken on old Safari + // https://bugs.webkit.org/show_bug.cgi?id=6129 + // Safari 3.0.4, 3.1 known ok + return "os-suggest-result-hl-webkit"; + } + } + return "os-suggest-result-hl"; +} + +function os_updateSearchQuery(r,newText){ + document.getElementById(r.searchbox).value = newText; + r.query = newText; +} + +/** Find event target */ +function os_getTarget(e){ + if (!e) e = window.event; + if (e.target) return e.target; + else if (e.srcElement) return e.srcElement; + else return null; +} + + + +/******************** + * Keyboard events + ********************/ + +/** Event handler that will fetch results on keyup */ +function os_eventKeyup(e){ + var targ = os_getTarget(e); + var r = os_map[targ.id]; + if(r == null) + return; // not our event + + // some browsers won't generate keypressed for arrow keys, catch it + if(os_keypressed_count == 0){ + os_processKey(r,os_cur_keypressed,targ); + } + var query = targ.value; + os_fetchResults(r,query,os_search_timeout); +} + +/** catch arrows up/down and escape to hide the suggestions */ +function os_processKey(r,keypressed,targ){ + if (keypressed == 40){ // Arrow Down + if (r.visible) { + os_changeHighlight(r, r.selected, r.selected+1, true); + } else if(os_timer == null){ + // user wants to get suggestions now + r.query = ""; + os_fetchResults(r,targ.value,0); + } + } else if (keypressed == 38){ // Arrow Up + if (r.visible){ + os_changeHighlight(r, r.selected, r.selected-1, true); + } + } else if(keypressed == 27){ // Escape + document.getElementById(r.searchbox).value = r.original; + r.query = r.original; + os_hideResults(r); + } else if(r.query != document.getElementById(r.searchbox).value){ + // os_hideResults(r); // don't show old suggestions + } +} + +/** When keys is held down use a timer to output regular events */ +function os_eventKeypress(e){ + var targ = os_getTarget(e); + var r = os_map[targ.id]; + if(r == null) + return; // not our event + + var keypressed = os_cur_keypressed; + if(keypressed == 38 || keypressed == 40){ + var d = new Date() + var now = d.getTime(); + if(now - os_last_keypress < 120){ + os_last_keypress = now; + return; + } + } + + os_keypressed_count++; + os_processKey(r,keypressed,targ); +} + +/** Catch the key code (Firefox bug) */ +function os_eventKeydown(e){ + if (!e) e = window.event; + var targ = os_getTarget(e); + var r = os_map[targ.id]; + if(r == null) + return; // not our event + + os_mouse_moved = false; + + os_cur_keypressed = (window.Event) ? e.which : e.keyCode; + os_last_keypress = 0; + os_keypressed_count = 0; +} + +/** Event: loss of focus of input box */ +function os_eventBlur(e){ + var targ = os_getTarget(e); + var r = os_map[targ.id]; + if(r == null) + return; // not our event + if(!os_mouse_pressed) + os_hideResults(r); +} + +/** Event: focus (catch only when stopped) */ +function os_eventFocus(e){ + // nothing happens here? +} + + + +/******************** + * Mouse events + ********************/ + +/** Mouse over the container */ +function os_eventMouseover(srcId, e){ + var targ = os_getTarget(e); + var r = os_map[srcId]; + if(r == null || !os_mouse_moved) + return; // not our event + var num = os_getNumberSuffix(targ.id); + if(num >= 0) + os_changeHighlight(r,r.selected,num,false); + +} + +/* Get row where the event occured (from its id) */ +function os_getNumberSuffix(id){ + var num = id.substring(id.length-2); + if( ! (num.charAt(0) >= '0' && num.charAt(0) <= '9') ) + num = num.substring(1); + if(os_isNumber(num)) + return parseInt(num); + else + return -1; +} + +/** Save mouse move as last action */ +function os_eventMousemove(srcId, e){ + os_mouse_moved = true; +} + +/** Mouse button held down, register possible click */ +function os_eventMousedown(srcId, e){ + var targ = os_getTarget(e); + var r = os_map[srcId]; + if(r == null) + return; // not our event + var num = os_getNumberSuffix(targ.id); + + os_mouse_pressed = true; + if(num >= 0){ + os_mouse_num = num; + // os_updateSearchQuery(r,r.results[num]); + } + // keep the focus on the search field + document.getElementById(r.searchbox).focus(); + + return false; // prevents selection +} + +/** Mouse button released, check for click on some row */ +function os_eventMouseup(srcId, e){ + var targ = os_getTarget(e); + var r = os_map[srcId]; + if(r == null) + return; // not our event + var num = os_getNumberSuffix(targ.id); + + if(num >= 0 && os_mouse_num == num){ + os_updateSearchQuery(r,r.results[num]); + os_hideResults(r); + document.getElementById(r.searchform).submit(); + } + os_mouse_pressed = false; + // keep the focus on the search field + document.getElementById(r.searchbox).focus(); +} + +/** Check if x is a valid integer */ +function os_isNumber(x){ + if(x == "" || isNaN(x)) + return false; + for(var i=0;i<x.length;i++){ + var c = x.charAt(i); + if( ! (c >= '0' && c <= '9') ) + return false; + } + return true; +} + + +/** When the form is submitted hide everything, cancel updates... */ +function os_eventOnsubmit(e){ + var targ = os_getTarget(e); + + os_is_stopped = true; + // kill timed requests + if(os_timer != null && os_timer.id != null){ + clearTimeout(os_timer.id); + os_timer = null; + } + // Hide all suggestions + for(i=0;i<os_autoload_inputs.length;i++){ + var r = os_map[os_autoload_inputs[i]]; + if(r != null){ + var b = document.getElementById(r.searchform); + if(b != null && b == targ){ + // set query value so the handler won't try to fetch additional results + r.query = document.getElementById(r.searchbox).value; + } + os_hideResults(r); + } + } + return true; +} + +function os_hookEvent(element, hookName, hookFunct) { + if (element.addEventListener) { + element.addEventListener(hookName, hookFunct, false); + } else if (window.attachEvent) { + element.attachEvent("on" + hookName, hookFunct); + } +} + +/** Init Result objects and event handlers */ +function os_initHandlers(name, formname, element){ + var r = new os_Results(name, formname); + // event handler + os_hookEvent(element, "keyup", function(event) { os_eventKeyup(event); }); + os_hookEvent(element, "keydown", function(event) { os_eventKeydown(event); }); + os_hookEvent(element, "keypress", function(event) { os_eventKeypress(event); }); + os_hookEvent(element, "blur", function(event) { os_eventBlur(event); }); + os_hookEvent(element, "focus", function(event) { os_eventFocus(event); }); + element.setAttribute("autocomplete","off"); + // stopping handler + os_hookEvent(document.getElementById(formname), "submit", function(event){ return os_eventOnsubmit(event); }); + os_map[name] = r; + // toggle link + if(document.getElementById(r.toggle) == null){ + // TODO: disable this while we figure out a way for this to work in all browsers + /* if(name=='searchInput'){ + // special case: place above the main search box + var t = os_createToggle(r,"os-suggest-toggle"); + var searchBody = document.getElementById('searchBody'); + var first = searchBody.parentNode.firstChild.nextSibling.appendChild(t); + } else{ + // default: place below search box to the right + var t = os_createToggle(r,"os-suggest-toggle-def"); + var top = element.offsetTop + element.offsetHeight; + var left = element.offsetLeft + element.offsetWidth; + t.style.position = "absolute"; + t.style.top = top + "px"; + t.style.left = left + "px"; + element.parentNode.appendChild(t); + // only now width gets calculated, shift right + left -= t.offsetWidth; + t.style.left = left + "px"; + t.style.visibility = "visible"; + } */ + } + +} + +/** Return the span element that contains the toggle link */ +function os_createToggle(r,className){ + var t = document.createElement("span"); + t.className = className; + t.setAttribute("id", r.toggle); + var link = document.createElement("a"); + link.setAttribute("href","javascript:void(0);"); + link.onclick = function(){ os_toggle(r.searchbox,r.searchform) }; + var msg = document.createTextNode(wgMWSuggestMessages[0]); + link.appendChild(msg); + t.appendChild(link); + return t; +} + +/** Call when user clicks on some of the toggle links */ +function os_toggle(inputId,formName){ + r = os_map[inputId]; + var msg = ''; + if(r == null){ + os_enableSuggestionsOn(inputId,formName); + r = os_map[inputId]; + msg = wgMWSuggestMessages[0]; + } else{ + os_disableSuggestionsOn(inputId,formName); + msg = wgMWSuggestMessages[1]; + } + // change message + var link = document.getElementById(r.toggle).firstChild; + link.replaceChild(document.createTextNode(msg),link.firstChild); +} + +/** Call this to enable suggestions on input (id=inputId), on a form (name=formName) */ +function os_enableSuggestionsOn(inputId, formName){ + os_initHandlers( inputId, formName, document.getElementById(inputId) ); +} + +/** Call this to disable suggestios on input box (id=inputId) */ +function os_disableSuggestionsOn(inputId){ + r = os_map[inputId]; + if(r != null){ + // cancel/hide results + os_timer = null; + os_hideResults(r); + // turn autocomplete on ! + document.getElementById(inputId).setAttribute("autocomplete","on"); + // remove descriptor + os_map[inputId] = null; + } +} + +/** Initialization, call upon page onload */ +function os_MWSuggestInit() { + for(i=0;i<os_autoload_inputs.length;i++){ + var id = os_autoload_inputs[i]; + var form = os_autoload_forms[i]; + element = document.getElementById( id ); + if(element != null) + os_initHandlers(id,form,element); + } +} + +hookEvent("load", os_MWSuggestInit); diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index ead422dc..5cffb073 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -101,16 +101,6 @@ img.thumbborder { /* Page history styling */ /* the auto-generated edit comments */ .autocomment { color: #4b4b4b; } -#pagehistory span.user { - margin-left: 1.4em; - margin-right: 0.4em; -} -#pagehistory span.minor { font-weight: bold; } -#pagehistory li { border: 1px solid White; } -#pagehistory li.selected { - background-color:#f9f9f9; - border:1px dashed #aaaaaa; -} img { border: none; } @@ -195,30 +185,6 @@ fieldset.operaprefsection { margin-left: 15em } .small, .small * { font-size: 94%; } table.small { font-size: 100% } -div.townBox { - position:relative; - float:right; - background:White; - margin-left:1em; - border: 1px solid gray; - padding:0.3em; - width: 200px; - overflow: hidden; - clear: right; -} -div.townBox dl { - padding: 0; - margin: 0 0 0.3em 0; - font-size: 96%; -} -div.townBox dl dt { - background: none; - margin: 0.4em 0 0 0; -} -div.townBox dl dd { - margin: 0.1em 0 0 1.1em; - background-color: #f3f3f3; -} /* use this instead of #toc for page content */ .toccolours { border:1px solid #aaaaaa; @@ -398,7 +364,6 @@ div.multipageimagenavbox { border: solid 1px silver; padding: 4px; margin: 1em; - -moz-border-radius: 6px; background: #f0f0f0; } @@ -441,12 +406,6 @@ table.multipageimage td { .templatesUsed { margin-top: 1em; } -/* Convenience links on Special:Ipblocklist */ -p.mw-ipb-conveniencelinks { - font-size: 90%; - float: right; -} - /* Recreating-deleted-page/reupload file warning and log entries */ div#mw-upload-deleted-warn ul li, div#mw-recreate-deleted-warn ul li { diff --git a/skins/common/prefs.js b/skins/common/prefs.js new file mode 100644 index 00000000..d9a612f9 --- /dev/null +++ b/skins/common/prefs.js @@ -0,0 +1,119 @@ + +// generate toc from prefs form, fold sections +// XXX: needs testing on IE/Mac and safari +// more comments to follow +function tabbedprefs() { + var prefform = document.getElementById('preferences'); + if (!prefform || !document.createElement) { + return; + } + if (prefform.nodeName.toLowerCase() == 'a') { + return; // Occasional IE problem + } + prefform.className = prefform.className + 'jsprefs'; + var sections = []; + var children = prefform.childNodes; + var seci = 0; + for (var i = 0; i < children.length; i++) { + if (children[i].nodeName.toLowerCase() == 'fieldset') { + children[i].id = 'prefsection-' + seci; + children[i].className = 'prefsection'; + if (is_opera || is_khtml) { + children[i].className = 'prefsection operaprefsection'; + } + var legends = children[i].getElementsByTagName('legend'); + sections[seci] = {}; + if (legends[0]) legends[0].className = 'mainLegend'; + if (legends[0] && legends[0].firstChild.nodeValue) { + sections[seci].text = legends[0].firstChild.nodeValue; + } else { + sections[seci].text = '# ' + seci; + } + sections[seci].secid = children[i].id; + seci++; + if (sections.length != 1) { + children[i].style.display = 'none'; + } else { + var selectedid = children[i].id; + } + } + } + var toc = document.createElement('ul'); + toc.id = 'preftoc'; + toc.selectedid = selectedid; + for (i = 0; i < sections.length; i++) { + var li = document.createElement('li'); + if (i === 0) { + li.className = 'selected'; + } + var a = document.createElement('a'); + a.href = '#' + sections[i].secid; + a.onmousedown = a.onclick = uncoversection; + a.appendChild(document.createTextNode(sections[i].text)); + a.secid = sections[i].secid; + li.appendChild(a); + toc.appendChild(li); + } + prefform.parentNode.insertBefore(toc, prefform.parentNode.childNodes[0]); + document.getElementById('prefsubmit').id = 'prefcontrol'; +} + +function uncoversection() { + var oldsecid = this.parentNode.parentNode.selectedid; + var newsec = document.getElementById(this.secid); + if (oldsecid != this.secid) { + var ul = document.getElementById('preftoc'); + document.getElementById(oldsecid).style.display = 'none'; + newsec.style.display = 'block'; + ul.selectedid = this.secid; + var lis = ul.getElementsByTagName('li'); + for (var i = 0; i< lis.length; i++) { + lis[i].className = ''; + } + this.parentNode.className = 'selected'; + } + return false; +} + +// Timezone stuff +// tz in format [+-]HHMM +function checkTimezone(tz, msg) { + var localclock = new Date(); + // returns negative offset from GMT in minutes + var tzRaw = localclock.getTimezoneOffset(); + var tzHour = Math.floor( Math.abs(tzRaw) / 60); + var tzMin = Math.abs(tzRaw) % 60; + var tzString = ((tzRaw >= 0) ? "-" : "+") + ((tzHour < 10) ? "0" : "") + tzHour + ((tzMin < 10) ? "0" : "") + tzMin; + if (tz != tzString) { + var junk = msg.split('$1'); + document.write(junk[0] + "UTC" + tzString + junk[1]); + } +} + +function unhidetzbutton() { + var tzb = document.getElementById('guesstimezonebutton'); + if (tzb) { + tzb.style.display = 'inline'; + } +} + +// in [-]HH:MM format... +// won't yet work with non-even tzs +function fetchTimezone() { + // FIXME: work around Safari bug + var localclock = new Date(); + // returns negative offset from GMT in minutes + var tzRaw = localclock.getTimezoneOffset(); + var tzHour = Math.floor( Math.abs(tzRaw) / 60); + var tzMin = Math.abs(tzRaw) % 60; + var tzString = ((tzRaw >= 0) ? "-" : "") + ((tzHour < 10) ? "0" : "") + tzHour + + ":" + ((tzMin < 10) ? "0" : "") + tzMin; + return tzString; +} + +function guessTimezone(box) { + document.getElementsByName("wpHourDiff")[0].value = fetchTimezone(); +} + +hookEvent("load", unhidetzbutton); +hookEvent("load", tabbedprefs); diff --git a/skins/common/preview.js b/skins/common/preview.js index ad096e2c..8c5c07d3 100644 --- a/skins/common/preview.js +++ b/skins/common/preview.js @@ -104,8 +104,7 @@ function lpStatusUpdate() { categoryContainer.style.display = 'block'; } else { /* Just dump them somewhere */ - /* previewContainer.innerHTML += '<div id="catlinks">' + - categoryElement.firstChild.data + '</div>';*/ + /* previewContainer.innerHTML += categoryElement.firstChild.data;*/ } } else { /* Nothing to show, hide old data */ diff --git a/skins/common/rightclickedit.js b/skins/common/rightclickedit.js new file mode 100644 index 00000000..83d552a2 --- /dev/null +++ b/skins/common/rightclickedit.js @@ -0,0 +1,48 @@ +function setupRightClickEdit() { + if (document.getElementsByTagName) { + var spans = document.getElementsByTagName('span'); + for (var i = 0; i < spans.length; i++) { + var el = spans[i]; + if(el.className == 'editsection') { + addRightClickEditHandler(el); + } + } + } +} + +function addRightClickEditHandler(el) { + for (var i = 0; i < el.childNodes.length; i++) { + var link = el.childNodes[i]; + if (link.nodeType == 1 && link.nodeName.toLowerCase() == 'a') { + var editHref = link.getAttribute('href'); + // find the enclosing (parent) header + var prev = el.parentNode; + if (prev && prev.nodeType == 1 && + prev.nodeName.match(/^[Hh][1-6]$/)) { + prev.oncontextmenu = function(e) { + if (!e) { e = window.event; } + // e is now the event in all browsers + var targ; + if (e.target) { targ = e.target; } + else if (e.srcElement) { targ = e.srcElement; } + if (targ.nodeType == 3) { // defeat Safari bug + targ = targ.parentNode; + } + // targ is now the target element + + // We don't want to deprive the noble reader of a context menu + // for the section edit link, do we? (Might want to extend this + // to all <a>'s?) + if (targ.nodeName.toLowerCase() != 'a' + || targ.parentNode.className != 'editsection') { + document.location = editHref; + return false; + } + return true; + }; + } + } + } +} + +hookEvent("load", setupRightClickEdit); diff --git a/skins/common/shared.css b/skins/common/shared.css index de02a10f..d42fc1c0 100644 --- a/skins/common/shared.css +++ b/skins/common/shared.css @@ -47,6 +47,10 @@ table.filehistory th.mw-imagepage-filesize { white-space:nowrap; } +table.filehistory td.filehistory-selected { + font-weight: bold; +} + /* * rev_deleted stuff */ @@ -77,3 +81,169 @@ body.rtl .magnify { float:left; } body.ltr .thumbcaption { text-align:left; } body.ltr .magnify { float:right; } + +/** + * Hidden categories + */ +.mw-hidden-cats-hidden { display: none; } +.catlinks-allhidden { display: none; } + +/* Convenience links to edit block and delete reasons */ +p.mw-ipb-conveniencelinks, p.mw-filedelete-editreasons, p.mw-delete-editreasons { + font-size: 90%; + float: right; +} + +/* Search results */ +div.searchresult { + font-size: 95%; + width:38em; +} +.mw-search-results li { + padding-bottom: 1em; +} +.mw-search-result-data { + color: green; + font-size: 97%; +} + +div#mw-search-interwiki { + float: right; + width: 18em; + border-style: solid; + border-color: #AAAAAA; + border-width: 1px; + margin-top: 2ex; +} + +div#mw-search-interwiki li { + font-size: 95%; +} + +.mw-search-interwiki-more { + float: right; + font-size: 90%; +} + +span.searchalttitle { + font-size: 95%; +} + +div.searchdidyoumean { + font-size: 127%; + padding-bottom:1ex; + padding-top:1ex; +} + +/* + * UserRights stuff + */ +.mw-userrights-disabled { + color: #888; +} + +table.mw-userrights-groups * td,table.mw-userrights-groups * th { + padding-right: 1.5em; +} + +/* + * OpenSearch ajax suggestions + */ +.os-suggest { + overflow: auto; + overflow-x: hidden; + position: absolute; + top: 0px; + left: 0px; + width: 0px; + background-color: white; + border-style: solid; + border-color: #AAAAAA; + border-width: 1px; + z-index:99; + visibility:hidden; + font-size:95%; +} + +table.os-suggest-results { + font-size: 95%; + cursor: pointer; + border: 0; + border-collapse: collapse; + width: 100%; +} + +td.os-suggest-result, td.os-suggest-result-hl { + white-space: nowrap; + background-color: white; + background-color: Window; + color: black; + color: WindowText; + padding: 2px; +} +td.os-suggest-result-hl, +td.os-suggest-result-hl-webkit { + background-color: #4C59A6; + color: white; +} +td.os-suggest-result-hl { + /* System colors are misimplemented in Safari 3.0 and earlier, + making highlighted text illegible... */ + background-color: Highlight; + color: HighlightText; +} + +.os-suggest-toggle { + position: relative; + left: 1ex; + font-size: 65%; +} +.os-suggest-toggle-def { + position: absolute; + top: 0px; + left: 0px; + font-size: 65%; + visibility: hidden; +} + +/* Page history styling */ +/* the auto-generated edit comments */ +.autocomment { color: gray; } +#pagehistory .history-user { + margin-left: 0.4em; + margin-right: 0.2em; +} +#pagehistory span.minor { font-weight: bold; } +#pagehistory li { border: 1px solid white; } +#pagehistory li.selected { + background-color: #f9f9f9; + border: 1px dashed #aaa; +} + +table.mw-listgrouprights-table { + border: 1px solid #ccc; + border-collapse: collapse; +} + +table.mw-listgrouprights-table tr { + vertical-align: top; +} + +table.mw-listgrouprights-table td, table.mw-listgrouprights-table th { + padding: 0.5em 0.2em 0.5em 0.2em; + border: 1px solid #ccc; +} + +/* Special:SpecialPages styling */ +h4.mw-specialpagesgroup { + background-color: #dcdcdc; + padding: 2px; + margin: .3em 0em 0em 0em; +} +.mw-specialpagerestricted { + font-weight: bold; +} + +#shared-image-dup, #shared-image-conflict { + font-style: italic; +} diff --git a/skins/common/upload.js b/skins/common/upload.js index f00c4db8..d1cf4b3e 100644 --- a/skins/common/upload.js +++ b/skins/common/upload.js @@ -112,6 +112,9 @@ var wgUploadWarningObj = { } function fillDestFilename(id) { + if (!wgUploadAutoFill) { + return; + } if (!document.getElementById) { return; } @@ -139,6 +142,17 @@ function fillDestFilename(id) { } } +function toggleFilenameFiller() { + if(!document.getElementById) return; + var upfield = document.getElementById('wpUploadFile'); + var destName = document.getElementById('wpDestFile').value; + if (destName=='' || destName==' ') { + wgUploadAutoFill = true; + } else { + wgUploadAutoFill = false; + } +} + var wgUploadLicenseObj = { 'responseCache' : { '' : '' }, diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index cdb5c9de..59f15cef 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1,18 +1,27 @@ // MediaWiki JavaScript support functions var clientPC = navigator.userAgent.toLowerCase(); // Get client info -var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) - && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1)); -var is_safari = ((clientPC.indexOf('applewebkit')!=-1) && (clientPC.indexOf('spoofer')==-1)); -var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled )); -// For accesskeys -var is_ff2_win = (clientPC.indexOf('firefox/2')!=-1 || clientPC.indexOf('minefield/3')!=-1) && clientPC.indexOf('windows')!=-1; -var is_ff2_x11 = (clientPC.indexOf('firefox/2')!=-1 || clientPC.indexOf('minefield/3')!=-1) && clientPC.indexOf('x11')!=-1; +var is_gecko = /gecko/.test( clientPC ) && + !/khtml|spoofer|netscape\/7\.0/.test(clientPC); +var webkit_match = clientPC.match(/applewebkit\/(\d+)/); +if (webkit_match) { + var is_safari = clientPC.indexOf('applewebkit') != -1 && + clientPC.indexOf('spoofer') == -1; + var is_safari_win = is_safari && clientPC.indexOf('windows') != -1; + var webkit_version = parseInt(webkit_match[1]); +} +var is_khtml = navigator.vendor == 'KDE' || + ( document.childNodes && !document.all && !navigator.taintEnabled ); +// For accesskeys; note that FF3+ is included here! +var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); +// These aren't used here, but some custom scripts rely on them +var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1; +var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1; if (clientPC.indexOf('opera') != -1) { var is_opera = true; - var is_opera_preseven = (window.opera && !document.childNodes); - var is_opera_seven = (window.opera && document.childNodes); - var is_opera_95 = (clientPC.search(/opera\/(9.[5-9]|[1-9][0-9])/)!=-1); + var is_opera_preseven = window.opera && !document.childNodes; + var is_opera_seven = window.opera && document.childNodes; + var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC ); } // Global external objects used by this script. @@ -27,7 +36,11 @@ if (!window.onloadFuncts) { function addOnloadHook(hookFunct) { // Allows add-on scripts to add onload functions - onloadFuncts[onloadFuncts.length] = hookFunct; + if(!doneOnloadHook) { + onloadFuncts[onloadFuncts.length] = hookFunct; + } else { + hookFunct(); // bug in MSIE script loading + } } function hookEvent(hookName, hookFunct) { @@ -38,14 +51,49 @@ function hookEvent(hookName, hookFunct) { } } -// document.write special stylesheet links +function importScript(page) { + return importScriptURI(wgScript + '?action=raw&ctype=text/javascript&title=' + encodeURIComponent(page.replace(/ /g,'_'))); +} + +var loadedScripts = {}; // included-scripts tracker +function importScriptURI(url) { + if (loadedScripts[url]) { + return null; + } + loadedScripts[url] = true; + var s = document.createElement('script'); + s.setAttribute('src',url); + s.setAttribute('type','text/javascript'); + document.getElementsByTagName('head')[0].appendChild(s); + return s; +} + +function importStylesheet(page) { + return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_'))); +} + +function importStylesheetURI(url) { + return document.createStyleSheet ? document.createStyleSheet(url) : appendCSS('@import "' + url + '";'); +} + +function appendCSS(text) { + var s = document.createElement('style'); + s.type = 'text/css'; + s.rel = 'stylesheet'; + if (s.styleSheet) s.styleSheet.cssText = text //IE + else s.appendChild(document.createTextNode(text + '')) //Safari sometimes borks on null + document.getElementsByTagName('head')[0].appendChild(s); + return s; +} + +// special stylesheet links if (typeof stylepath != 'undefined' && typeof skin != 'undefined') { if (is_opera_preseven) { - document.write('<link rel="stylesheet" type="text/css" href="'+stylepath+'/'+skin+'/Opera6Fixes.css">'); + importStylesheetURI(stylepath+'/'+skin+'/Opera6Fixes.css'); } else if (is_opera_seven && !is_opera_95) { - document.write('<link rel="stylesheet" type="text/css" href="'+stylepath+'/'+skin+'/Opera7Fixes.css">'); + importStylesheetURI(stylepath+'/'+skin+'/Opera7Fixes.css'); } else if (is_khtml) { - document.write('<link rel="stylesheet" type="text/css" href="'+stylepath+'/'+skin+'/KHTMLFixes.css">'); + importStylesheetURI(stylepath+'/'+skin+'/KHTMLFixes.css'); } } @@ -72,204 +120,6 @@ function toggleVisibility(_levelId, _otherId, _linkId) { } } -function historyRadios(parent) { - var inputs = parent.getElementsByTagName('input'); - var radios = []; - for (var i = 0; i < inputs.length; i++) { - if (inputs[i].name == "diff" || inputs[i].name == "oldid") { - radios[radios.length] = inputs[i]; - } - } - return radios; -} - -// check selection and tweak visibility/class onclick -function diffcheck() { - var dli = false; // the li where the diff radio is checked - var oli = false; // the li where the oldid radio is checked - var hf = document.getElementById('pagehistory'); - if (!hf) { - return true; - } - var lis = hf.getElementsByTagName('li'); - for (var i=0;i<lis.length;i++) { - var inputs = historyRadios(lis[i]); - if (inputs[1] && inputs[0]) { - if (inputs[1].checked || inputs[0].checked) { // this row has a checked radio button - if (inputs[1].checked && inputs[0].checked && inputs[0].value == inputs[1].value) { - return false; - } - if (oli) { // it's the second checked radio - if (inputs[1].checked) { - oli.className = "selected"; - return false; - } - } else if (inputs[0].checked) { - return false; - } - if (inputs[0].checked) { - dli = lis[i]; - } - if (!oli) { - inputs[0].style.visibility = 'hidden'; - } - if (dli) { - inputs[1].style.visibility = 'hidden'; - } - lis[i].className = "selected"; - oli = lis[i]; - } else { // no radio is checked in this row - if (!oli) { - inputs[0].style.visibility = 'hidden'; - } else { - inputs[0].style.visibility = 'visible'; - } - if (dli) { - inputs[1].style.visibility = 'hidden'; - } else { - inputs[1].style.visibility = 'visible'; - } - lis[i].className = ""; - } - } - } - return true; -} - -// page history stuff -// attach event handlers to the input elements on history page -function histrowinit() { - var hf = document.getElementById('pagehistory'); - if (!hf) { - return; - } - var lis = hf.getElementsByTagName('li'); - for (var i = 0; i < lis.length; i++) { - var inputs = historyRadios(lis[i]); - if (inputs[0] && inputs[1]) { - inputs[0].onclick = diffcheck; - inputs[1].onclick = diffcheck; - } - } - diffcheck(); -} - -// generate toc from prefs form, fold sections -// XXX: needs testing on IE/Mac and safari -// more comments to follow -function tabbedprefs() { - var prefform = document.getElementById('preferences'); - if (!prefform || !document.createElement) { - return; - } - if (prefform.nodeName.toLowerCase() == 'a') { - return; // Occasional IE problem - } - prefform.className = prefform.className + 'jsprefs'; - var sections = []; - var children = prefform.childNodes; - var seci = 0; - for (var i = 0; i < children.length; i++) { - if (children[i].nodeName.toLowerCase() == 'fieldset') { - children[i].id = 'prefsection-' + seci; - children[i].className = 'prefsection'; - if (is_opera || is_khtml) { - children[i].className = 'prefsection operaprefsection'; - } - var legends = children[i].getElementsByTagName('legend'); - sections[seci] = {}; - legends[0].className = 'mainLegend'; - if (legends[0] && legends[0].firstChild.nodeValue) { - sections[seci].text = legends[0].firstChild.nodeValue; - } else { - sections[seci].text = '# ' + seci; - } - sections[seci].secid = children[i].id; - seci++; - if (sections.length != 1) { - children[i].style.display = 'none'; - } else { - var selectedid = children[i].id; - } - } - } - var toc = document.createElement('ul'); - toc.id = 'preftoc'; - toc.selectedid = selectedid; - for (i = 0; i < sections.length; i++) { - var li = document.createElement('li'); - if (i === 0) { - li.className = 'selected'; - } - var a = document.createElement('a'); - a.href = '#' + sections[i].secid; - a.onmousedown = a.onclick = uncoversection; - a.appendChild(document.createTextNode(sections[i].text)); - a.secid = sections[i].secid; - li.appendChild(a); - toc.appendChild(li); - } - prefform.parentNode.insertBefore(toc, prefform.parentNode.childNodes[0]); - document.getElementById('prefsubmit').id = 'prefcontrol'; -} - -function uncoversection() { - var oldsecid = this.parentNode.parentNode.selectedid; - var newsec = document.getElementById(this.secid); - if (oldsecid != this.secid) { - var ul = document.getElementById('preftoc'); - document.getElementById(oldsecid).style.display = 'none'; - newsec.style.display = 'block'; - ul.selectedid = this.secid; - var lis = ul.getElementsByTagName('li'); - for (var i = 0; i< lis.length; i++) { - lis[i].className = ''; - } - this.parentNode.className = 'selected'; - } - return false; -} - -// Timezone stuff -// tz in format [+-]HHMM -function checkTimezone(tz, msg) { - var localclock = new Date(); - // returns negative offset from GMT in minutes - var tzRaw = localclock.getTimezoneOffset(); - var tzHour = Math.floor( Math.abs(tzRaw) / 60); - var tzMin = Math.abs(tzRaw) % 60; - var tzString = ((tzRaw >= 0) ? "-" : "+") + ((tzHour < 10) ? "0" : "") + tzHour + ((tzMin < 10) ? "0" : "") + tzMin; - if (tz != tzString) { - var junk = msg.split('$1'); - document.write(junk[0] + "UTC" + tzString + junk[1]); - } -} - -function unhidetzbutton() { - var tzb = document.getElementById('guesstimezonebutton'); - if (tzb) { - tzb.style.display = 'inline'; - } -} - -// in [-]HH:MM format... -// won't yet work with non-even tzs -function fetchTimezone() { - // FIXME: work around Safari bug - var localclock = new Date(); - // returns negative offset from GMT in minutes - var tzRaw = localclock.getTimezoneOffset(); - var tzHour = Math.floor( Math.abs(tzRaw) / 60); - var tzMin = Math.abs(tzRaw) % 60; - var tzString = ((tzRaw >= 0) ? "-" : "") + ((tzHour < 10) ? "0" : "") + tzHour + - ":" + ((tzMin < 10) ? "0" : "") + tzMin; - return tzString; -} - -function guessTimezone(box) { - document.getElementsByName("wpHourDiff")[0].value = fetchTimezone(); -} - function showTocToggle() { if (document.createTextNode) { // Uses DOM calls to avoid document.write + XHTML issues @@ -329,65 +179,6 @@ function toggleToc() { var mwEditButtons = []; var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js -// this function generates the actual toolbar buttons with localized text -// we use it to avoid creating the toolbar where javascript is not enabled -function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) { - // Don't generate buttons for browsers which don't fully - // support it. - mwEditButtons[mwEditButtons.length] = - {"imageId": imageId, - "imageFile": imageFile, - "speedTip": speedTip, - "tagOpen": tagOpen, - "tagClose": tagClose, - "sampleText": sampleText}; -} - -// this function generates the actual toolbar buttons with localized text -// we use it to avoid creating the toolbar where javascript is not enabled -function mwInsertEditButton(parent, item) { - var image = document.createElement("img"); - image.width = 23; - image.height = 22; - image.className = "mw-toolbar-editbutton"; - if (item.imageId) image.id = item.imageId; - image.src = item.imageFile; - image.border = 0; - image.alt = item.speedTip; - image.title = item.speedTip; - image.style.cursor = "pointer"; - image.onclick = function() { - insertTags(item.tagOpen, item.tagClose, item.sampleText); - return false; - }; - - parent.appendChild(image); - return true; -} - -function mwSetupToolbar() { - var toolbar = document.getElementById('toolbar'); - if (!toolbar) { return false; } - - var textbox = document.getElementById('wpTextbox1'); - if (!textbox) { return false; } - - // Don't generate buttons for browsers which don't fully - // support it. - if (!(document.selection && document.selection.createRange) - && textbox.selectionStart === null) { - return false; - } - - for (var i = 0; i < mwEditButtons.length; i++) { - mwInsertEditButton(toolbar, mwEditButtons[i]); - } - for (var i = 0; i < mwCustomEditButtons.length; i++) { - mwInsertEditButton(toolbar, mwCustomEditButtons[i]); - } - return true; -} - function escapeQuotes(text) { var re = new RegExp("'","g"); text = text.replace(re,"\\'"); @@ -408,85 +199,6 @@ function escapeQuotesHTML(text) { return text; } -// apply tagOpen/tagClose to selection in textarea, -// use sampleText instead of selection if there is none -function insertTags(tagOpen, tagClose, sampleText) { - var txtarea; - if (document.editform) { - txtarea = document.editform.wpTextbox1; - } else { - // some alternate form? take the first one we can find - var areas = document.getElementsByTagName('textarea'); - txtarea = areas[0]; - } - var selText, isSample = false; - - if (document.selection && document.selection.createRange) { // IE/Opera - - //save window scroll position - if (document.documentElement && document.documentElement.scrollTop) - var winScroll = document.documentElement.scrollTop - else if (document.body) - var winScroll = document.body.scrollTop; - //get current selection - txtarea.focus(); - var range = document.selection.createRange(); - selText = range.text; - //insert tags - checkSelectedText(); - range.text = tagOpen + selText + tagClose; - //mark sample text as selected - if (isSample && range.moveStart) { - if (window.opera) - tagClose = tagClose.replace(/\n/g,''); - range.moveStart('character', - tagClose.length - selText.length); - range.moveEnd('character', - tagClose.length); - } - range.select(); - //restore window scroll position - if (document.documentElement && document.documentElement.scrollTop) - document.documentElement.scrollTop = winScroll - else if (document.body) - document.body.scrollTop = winScroll; - - } else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla - - //save textarea scroll position - var textScroll = txtarea.scrollTop; - //get current selection - txtarea.focus(); - var startPos = txtarea.selectionStart; - var endPos = txtarea.selectionEnd; - selText = txtarea.value.substring(startPos, endPos); - //insert tags - checkSelectedText(); - txtarea.value = txtarea.value.substring(0, startPos) - + tagOpen + selText + tagClose - + txtarea.value.substring(endPos, txtarea.value.length); - //set new selection - if (isSample) { - txtarea.selectionStart = startPos + tagOpen.length; - txtarea.selectionEnd = startPos + tagOpen.length + selText.length; - } else { - txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; - txtarea.selectionEnd = txtarea.selectionStart; - } - //restore textarea scroll position - txtarea.scrollTop = textScroll; - } - - function checkSelectedText(){ - if (!selText) { - selText = sampleText; - isSample = true; - } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char - selText = selText.substring(0, selText.length - 1); - tagClose += ' ' - } - } - -} - /** * Set the accesskey prefix based on browser detection. @@ -494,14 +206,16 @@ function insertTags(tagOpen, tagClose, sampleText) { var tooltipAccessKeyPrefix = 'alt-'; if (is_opera) { tooltipAccessKeyPrefix = 'shift-esc-'; -} else if (is_safari - || navigator.userAgent.toLowerCase().indexOf('mac') != -1 - || navigator.userAgent.toLowerCase().indexOf('konqueror') != -1 ) { +} else if (!is_safari_win && is_safari && webkit_version > 526) { + tooltipAccessKeyPrefix = 'ctrl-alt-'; +} else if (!is_safari_win && (is_safari + || clientPC.indexOf('mac') != -1 + || clientPC.indexOf('konqueror') != -1 )) { tooltipAccessKeyPrefix = 'ctrl-'; -} else if (is_ff2_x11 || is_ff2_win) { +} else if (is_ff2) { tooltipAccessKeyPrefix = 'alt-shift-'; } -var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?.\]$/; +var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/; /** * Add the appropriate prefix to the accesskey shown in the tooltip. @@ -526,10 +240,9 @@ function updateTooltipAccessKeys( nodeList ) { for ( var i = 0; i < nodeList.length; i++ ) { var element = nodeList[i]; var tip = element.getAttribute("title"); - var key = element.getAttribute("accesskey"); - if ( key && tooltipAccessKeyRegexp.exec(tip) ) { + if ( tip && tooltipAccessKeyRegexp.exec(tip) ) { tip = tip.replace(tooltipAccessKeyRegexp, - "["+tooltipAccessKeyPrefix+key+"]"); + "["+tooltipAccessKeyPrefix+"$5]"); element.setAttribute("title", tip ); } } @@ -655,53 +368,6 @@ function akeytt( doId ) { } } -function setupRightClickEdit() { - if (document.getElementsByTagName) { - var spans = document.getElementsByTagName('span'); - for (var i = 0; i < spans.length; i++) { - var el = spans[i]; - if(el.className == 'editsection') { - addRightClickEditHandler(el); - } - } - } -} - -function addRightClickEditHandler(el) { - for (var i = 0; i < el.childNodes.length; i++) { - var link = el.childNodes[i]; - if (link.nodeType == 1 && link.nodeName.toLowerCase() == 'a') { - var editHref = link.getAttribute('href'); - // find the enclosing (parent) header - var prev = el.parentNode; - if (prev && prev.nodeType == 1 && - prev.nodeName.match(/^[Hh][1-6]$/)) { - prev.oncontextmenu = function(e) { - if (!e) { e = window.event; } - // e is now the event in all browsers - var targ; - if (e.target) { targ = e.target; } - else if (e.srcElement) { targ = e.srcElement; } - if (targ.nodeType == 3) { // defeat Safari bug - targ = targ.parentNode; - } - // targ is now the target element - - // We don't want to deprive the noble reader of a context menu - // for the section edit link, do we? (Might want to extend this - // to all <a>'s?) - if (targ.nodeName.toLowerCase() != 'a' - || targ.parentNode.className != 'editsection') { - document.location = editHref; - return false; - } - return true; - }; - } - } - } -} - var checkboxes; var lastCheckbox; @@ -776,108 +442,6 @@ function toggle_element_check(ida,idb) { document.getElementById(idb).checked=false; } -/** - * Restore the edit box scroll state following a preview operation, - * and set up a form submission handler to remember this state - */ -function scrollEditBox() { - var editBox = document.getElementById( 'wpTextbox1' ); - var scrollTop = document.getElementById( 'wpScrolltop' ); - var editForm = document.getElementById( 'editform' ); - if( editBox && scrollTop ) { - if( scrollTop.value ) - editBox.scrollTop = scrollTop.value; - addHandler( editForm, 'submit', function() { - document.getElementById( 'wpScrolltop' ).value = document.getElementById( 'wpTextbox1' ).scrollTop; - } ); - } -} -hookEvent( 'load', scrollEditBox ); - -var allmessages_nodelist = false; -var allmessages_modified = false; -var allmessages_timeout = false; -var allmessages_running = false; - -function allmessagesmodified() { - allmessages_modified = !allmessages_modified; - allmessagesfilter(); -} - -function allmessagesfilter() { - if ( allmessages_timeout ) - window.clearTimeout( allmessages_timeout ); - - if ( !allmessages_running ) - allmessages_timeout = window.setTimeout( 'allmessagesfilter_do();', 500 ); -} - -function allmessagesfilter_do() { - if ( !allmessages_nodelist ) - return; - - var text = document.getElementById('allmessagesinput').value; - var nodef = allmessages_modified; - - allmessages_running = true; - - for ( var name in allmessages_nodelist ) { - var nodes = allmessages_nodelist[name]; - var display = ( name.indexOf( text ) == -1 ? 'none' : '' ); - - for ( var i = 0; i < nodes.length; i++) - nodes[i].style.display = - ( nodes[i].className == "def" && nodef - ? 'none' : display ); - } - - if ( text != document.getElementById('allmessagesinput').value || - nodef != allmessages_modified ) - allmessagesfilter_do(); // repeat - - allmessages_running = false; -} - -function allmessagesfilter_init() { - if ( allmessages_nodelist ) - return; - - var nodelist = new Array(); - var templist = new Array(); - - var table = document.getElementById('allmessagestable'); - if ( !table ) return; - - var rows = document.getElementsByTagName('tr'); - for ( var i = 0; i < rows.length; i++ ) { - var id = rows[i].getAttribute('id') - if ( id && id.substring(0,16) != 'sp-allmessages-r' ) continue; - templist[ id ] = rows[i]; - } - - var spans = table.getElementsByTagName('span'); - for ( var i = 0; i < spans.length; i++ ) { - var id = spans[i].getAttribute('id') - if ( id && id.substring(0,17) != 'sp-allmessages-i-' ) continue; - if ( !spans[i].firstChild || spans[i].firstChild.nodeType != 3 ) continue; - - var nodes = new Array(); - var row1 = templist[ id.replace('i', 'r1') ]; - var row2 = templist[ id.replace('i', 'r2') ]; - - if ( row1 ) nodes[nodes.length] = row1; - if ( row2 ) nodes[nodes.length] = row2; - nodelist[ spans[i].firstChild.nodeValue ] = nodes; - } - - var k = document.getElementById('allmessagesfilter'); - if (k) { k.style.display = ''; } - - allmessages_nodelist = nodelist; -} - -hookEvent( "load", allmessagesfilter_init ); - /* Written by Jonathan Snook, http://www.snook.ca/jonathan Add-ons by Robert Nyman, http://www.robertnyman.com @@ -939,11 +503,10 @@ function redirectToFragment(fragment) { } /* - * Table sorting script by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/. - * Based on a script from http://www.kryogenix.org/code/browser/sorttable/. - * Distributed under the MIT license: http://www.kryogenix.org/code/browser/licence.html . - * - * Copyright (c) 1997-2006 Stuart Langridge, Joost de Valk. + * Table sorting script based on one (c) 1997-2006 Stuart Langridge and Joost + * de Valk: + * http://www.joostdevalk.nl/code/sortable-table/ + * http://www.kryogenix.org/code/browser/sorttable/ * * @todo don't break on colspans/rowspans (bug 8028) * @todo language-specific digit grouping/decimals (bug 8063) @@ -1207,7 +770,7 @@ function ts_alternate(table) { * Add a cute little box at the top of the screen to inform the user of * something, replacing any preexisting message. * - * @param String message HTML to be put inside the right div + * @param String -or- Dom Object message HTML to be put inside the right div * @param String className Used in adding a class; should be different for each * call to allow CSS/JS to hide different boxes. null = no class used. * @return Boolean True on success, false on failure @@ -1245,7 +808,15 @@ function jsMsg( message, className ) { if( className ) { messageDiv.setAttribute( 'class', 'mw-js-message-'+className ); } - messageDiv.innerHTML = message; + + if (typeof message === 'object') { + while (messageDiv.hasChildNodes()) // Remove old content + messageDiv.removeChild(messageDiv.firstChild); + messageDiv.appendChild (message); // Append new content + } + else { + messageDiv.innerHTML = message; + } return true; } @@ -1289,12 +860,8 @@ function runOnloadHook() { // might cause the function to terminate prematurely doneOnloadHook = true; - histrowinit(); - unhidetzbutton(); - tabbedprefs(); updateTooltipAccessKeys( null ); akeytt( null ); - scrollEditBox(); setupCheckboxShiftClick(); sortables_init(); @@ -1331,4 +898,3 @@ function addClickHandler( element, handler ) { //note: all skins should call runOnloadHook() at the end of html output, // so the below should be redundant. It's there just in case. hookEvent("load", runOnloadHook); -hookEvent("load", mwSetupToolbar); diff --git a/skins/common/wikistandard.css b/skins/common/wikistandard.css index 532e4fdc..3fe8d2fb 100644 --- a/skins/common/wikistandard.css +++ b/skins/common/wikistandard.css @@ -42,7 +42,7 @@ h6 .editsection { font-size: 105.3%; } hr.sep { color:gray;height:1px;background-color:gray;} p.subpages { font-size:small;} p.subtitle { padding-top: 0; margin-top: 0;} -p.catlinks { font-size:small; margin-top:0; text-align:right;} +.catlinks { font-size:small; margin-top:0; text-align:right;} td { empty-cells:show; } td.bottom { border-top: 1px solid gray; } td.top { border-bottom: 1px solid gray; } diff --git a/skins/modern/main.css b/skins/modern/main.css index 78cd2b22..d86a1f87 100644 --- a/skins/modern/main.css +++ b/skins/modern/main.css @@ -3,7 +3,7 @@ body { padding: 0 0 0 0; /*font-size: 10pt;*/ font-size: x-small; - + font-family: sans-serif; color: black; @@ -12,7 +12,8 @@ body { #mw_main, #p-personal, -#mw_header { +#mw_header, +.os-suggest { font-size: 130%; } @@ -116,7 +117,7 @@ body { #mw_portlets { width: 14em; - + border-right: solid 1px #bbbbbb; background-color: #f0f0f0; } @@ -139,7 +140,7 @@ div.mw_clear { } .portlet div.pBody { - padding: 1em 0 1em 0; + padding: 0em 0 1em 0; } textarea { @@ -276,6 +277,14 @@ p { margin: 1em 0 1em 0; } +hr { + height: 1px; + color: #aaa; + background-color: #aaa; + border: 0; + margin: .2em 0 .2em 0; +} + #contentSub { color: #888; font-size: small; @@ -340,6 +349,7 @@ h1, h2 { margin: 0 0 0 0; padding: 0em 1em 1em 1em; border: solid 1px #bbbbbb; + clear: left; /* Multi-line toc should not push data to horizontally */ } #preferences fieldset { @@ -354,6 +364,16 @@ h1, h2 { display: none; } +.prefsectiontip { + font-size: x-small; + padding: .2em 2em; + color: #666; +} + +.prefsection legend { + font-weight: bold; +} + #preftoc li.selected { background-color: #bbbbbb; } @@ -397,6 +417,7 @@ h1, h2 { padding-right: 18px; } #mw_content a[href ^="irc://"], +#mw_content a.extiw[href ^="irc://"], .link-irc { background: url(discussionitem_icon.gif) center right no-repeat; padding-right: 18px; @@ -538,7 +559,7 @@ img.thumbborder { background-color: #dddddd; margin: 0 0 0 0; } - + #toc h2, .toc h2 { display: inline; @@ -579,14 +600,14 @@ img.thumbborder { text-align: center; } -#catlinks { +.catlinks { border: solid 1px #bbbbbb; background-color: #f0f0f0; padding: 0.5em 0.5em 0.5em 0.5em; margin: 0 0 0 0; } -#catlinks p { +.catlinks { margin: 0 0 0 0; padding: 0 0 0 0; } @@ -597,26 +618,6 @@ img.thumbborder { overflow: hidden; } -.autocomment { - color: gray; -} - - -#pagehistory span.user { - margin-left: 1.4em; - margin-right: .4em; -} -#pagehistory span.minor { - font-weight: bold; -} -#pagehistory li { - border: 1px solid white; -} -#pagehistory li.selected { - background-color: #f9f9f9; - border: 1px dashed #aaa; -} - /* disable interwiki styling */ #mw_content a.extiw, #mw_content a.extiw:active { @@ -819,10 +820,6 @@ input#wpSave, input#wpDiff { margin-right: 0.33em; } -#editform .editOptions { - display: inline; -} - #wpSave { font-weight: bold; } @@ -919,7 +916,6 @@ div.multipageimagenavbox { border: solid 1px silver; padding: 4px; margin: 1em; - -moz-border-radius: 6px; background: #f0f0f0; } @@ -970,7 +966,7 @@ tr.sv-space td { display: none; } */ .TablePager_nav a { text-decoration: none; } .TablePager { border-collapse: collapse; } -.TablePager, .TablePager td, .TablePager th { +.TablePager, .TablePager td, .TablePager th { border: 1px solid #aaaaaa; padding: 0 0.15em 0 0.15em; } @@ -989,12 +985,6 @@ tr.sv-space td { display: none; } margin: 0.1em 0; } -/* Convenience links on Special:Ipblocklist */ -p.mw-ipb-conveniencelinks { - font-size: 90%; - float: right; -} - /* Friendlier slave lag warnings */ div.mw-lag-warn-normal, div.mw-lag-warn-high { @@ -1061,6 +1051,11 @@ dl { color: #cc2200; } +span.subpages { + font-size: 80%; + display: block; +} + pre { border: solid 1px #3c78b5; padding: 0.4em; @@ -1115,5 +1110,3 @@ pre { margin:0pt; padding:0pt; } - - diff --git a/skins/modern/rtl.css b/skins/modern/rtl.css index c92dbcfe..239bc8d4 100644 --- a/skins/modern/rtl.css +++ b/skins/modern/rtl.css @@ -20,8 +20,7 @@ div div.thumbcaption { text-align: right; } -div.magnify, -#div.townBox { +div.magnify { left: auto; right: 0; } @@ -43,14 +42,6 @@ div.tright, div.floatright, table.floatright { div.tleft, div.floatleft, table.floatleft { clear: left; } -div.townBox { - margin-left: 0; - margin-right: 1em; -} -div.townBox dl dd { - margin-left: 0; - margin-right: 1.1em; -} /* Fix link icons */ .external { @@ -91,8 +82,8 @@ input#wpSave, input#wpDiff { float: right; margin: 0 0 1em 3em; } -/* Unblock and Ipblocklist links of Special:Blockip */ -p.mw-ipb-conveniencelinks { +/* Convenience links to edit block and delete reasons */ +p.mw-ipb-conveniencelinks, p.mw-filedelete-editreasons, p.mw-delete-editreasons { float: left; } @@ -140,3 +131,16 @@ table.filehistory th { border-right: none; border-left: solid 1px #bbbbbb; } + +/** + * Lists: + * The following lines don't have a visible effect on non-Gecko browsers + * They fix a problem ith Gecko browsers rendering lists to the right of + * left-floated objects in an RTL layout. + */ +html > body div#mw_contentholder ul { + display: table; +} +html > body div#mw_contentholder ul#filetoc { + display: block; +} diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 7192b5f3..8db47d2b 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -17,7 +17,7 @@ } #content { margin: 2.8em 0 0 12.2em; - padding: 0 1em 1.5em 1em; + padding: 0 1em 1em 1em; position: relative; z-index: 2; } @@ -67,6 +67,10 @@ table { floated tables */ background-color: white; } +fieldset table { + /* but keep table layouts in forms clean... */ + background: none; +} a { text-decoration: none; color: #002bb8; @@ -173,6 +177,10 @@ fieldset { padding: 0 1em 1em; line-height: 1.5em; } +fieldset.nested { + margin: 0 0 0.5em 0; + padding: 0 0.5em 0.5em; +} legend { padding: .5em; font-size: 95%; @@ -254,6 +262,10 @@ span.subpages { } .firstHeading { margin-bottom: .1em; + /* These two rules hack around bug 2013 (fix for more limited bug 11325). + When bug 2013 is fixed properly, they should be removed. */ + line-height: 1.2em; + padding-bottom: 0; } /* user notification thing */ @@ -275,6 +287,10 @@ span.subpages { margin: 0; padding: 0; } +.success { + color: green; + font-size: larger; +} .error { color: red; font-size: larger; @@ -303,7 +319,7 @@ span.subpages { border: none; } -#catlinks { +.catlinks { border: 1px solid #aaa; background-color: #f9f9f9; padding: 5px; @@ -494,30 +510,6 @@ table.rimage { padding: 5px; font-size: 95%; } -div.townBox { - position: relative; - float: right; - background: white; - margin-left: 1em; - border: 1px solid gray; - padding: .3em; - width: 200px; - overflow: hidden; - clear: right; -} -div.townBox dl { - padding: 0; - margin: 0 0 .3em; - font-size: 96%; -} -div.townBox dl dt { - background: none; - margin: .4em 0 0; -} -div.townBox dl dd { - margin: .1em 0 0 1.1em; - background-color: #f3f3f3; -} /* ** edit views etc @@ -528,26 +520,6 @@ div.townBox dl dd { padding: 0; } -/* Page history styling */ -/* the auto-generated edit comments */ -.autocomment { - color: gray; -} -#pagehistory span.user { - margin-left: 1.4em; - margin-right: .4em; -} -#pagehistory span.minor { - font-weight: bold; -} -#pagehistory li { - border: 1px solid white; -} -#pagehistory li.selected { - background-color: #f9f9f9; - border: 1px dashed #aaa; -} - /* ** keep the whitespace in front of the ^=, hides rule from konqueror ** this is css3, the validator doesn't like it when validating as css2 @@ -577,6 +549,7 @@ div.townBox dl dd { padding-right: 18px; } #bodyContent a[href ^="irc://"], +#bodyContent a.extiw[href ^="irc://"], .link-irc { background: url(discussionitem_icon.gif) center right no-repeat; padding-right: 18px; @@ -1073,6 +1046,10 @@ div#userlogin form#userlogin2 { background-color: #f9f9f9; float: left; } +.rtl div#userloginForm form, +.rtl div#userlogin form#userlogin2 { + float: right; +} div#userloginForm table, div#userlogin form#userlogin2 table { @@ -1091,6 +1068,9 @@ div#userloginForm .captcha { background-color: white; } +#loginend, #signupend { + clear: both; +} #userloginprompt, #languagelinks { font-size: 85%; @@ -1171,7 +1151,7 @@ div.patrollink { font-size: 75%; text-align: right; } -span.newpage, span.minor, span.searchmatch, span.bot { +span.newpage, span.minor, span.bot { font-weight: bold; } span.unpatrolled { @@ -1179,9 +1159,6 @@ span.unpatrolled { color: red; } -span.searchmatch { - color: red; -} .sharedUploadNotice { font-style: italic; } @@ -1344,10 +1321,6 @@ input#wpSave, input#wpDiff { margin-right: 0.33em; } -#editform .editOptions { - display: inline; -} - #wpSave { font-weight: bold; } @@ -1436,7 +1409,7 @@ div#searchTarget ul li:before { div#searchTargetHide { float:right; border:solid 1px black; - background:gainsboro; + background:#DCDCDC; padding:2px; } @@ -1444,7 +1417,6 @@ div.multipageimagenavbox { border: solid 1px silver; padding: 4px; margin: 1em; - -moz-border-radius: 6px; background: #f0f0f0; } @@ -1514,12 +1486,6 @@ tr.sv-space td { display: none; } margin: 0.1em 0; } -/* Convenience links on Special:Ipblocklist */ -p.mw-ipb-conveniencelinks { - font-size: 90%; - float: right; -} - /* Friendlier slave lag warnings */ div.mw-lag-warn-normal, div.mw-lag-warn-high { @@ -1557,3 +1523,30 @@ div#mw-recreate-deleted-warn ul li { vertical-align: middle; font-size: 90%; } + +/** Special:Search stuff */ +div#mw-search-interwiki-caption { + text-align: center; + font-weight: bold; + font-size: 95%; +} + +.mw-search-interwiki-project { + font-size: 97%; + text-align: left; + padding-left: 0.2em; + padding-right: 0.15em; + padding-bottom: 0.2em; + padding-top: 0.15em; + background: #cae8ff; +} + +span.searchmatch { + font-weight: bold; + color: red; +} + +/* God-damned hack for the crappy layout */ +.os-suggest { + font-size: 127%; +} diff --git a/skins/monobook/rtl.css b/skins/monobook/rtl.css index 2bd5261e..f00cf09f 100644 --- a/skins/monobook/rtl.css +++ b/skins/monobook/rtl.css @@ -24,7 +24,6 @@ To test: */ body { direction: rtl; -/* unicode-bidi: bidi-override;*/ unicode-bidi: embed; } #column-content { @@ -37,7 +36,7 @@ body { border-right: 1px solid #aaaaaa; border-left: none; } -html>body .portlet { +html > body .portlet { float: right; clear: right; } @@ -69,7 +68,6 @@ div div.thumbcaption { } div.magnify, -#div.townBox, #p-logo { left: auto; right: 0; @@ -135,14 +133,6 @@ div.tright, div.floatright, table.floatright { div.tleft, div.floatleft, table.floatleft { clear: left; } -div.townBox { - margin-left: 0; - margin-right: 1em; -} -div.townBox dl dd { - margin-left: 0; - margin-right: 1.1em; -} #p-personal li { margin-left: 0; margin-right: 1em; @@ -215,8 +205,8 @@ input#wpSave, input#wpDiff { float: right; margin: 0 0 1em 3em; } -/* Unblock and Ipblocklist links of Special:Blockip */ -p.mw-ipb-conveniencelinks { +/* Convenience links to edit block and delete reasons */ +p.mw-ipb-conveniencelinks, p.mw-filedelete-editreasons, p.mw-delete-editreasons { float: left; } @@ -234,5 +224,9 @@ table.filehistory th { * They fix a problem ith Gecko browsers rendering lists to the right of * left-floated objects in an RTL layout. */ -html>body.rtl #bodyContent ul { display:table; } -html>body.rtl #bodyContent ol { display:table; }
\ No newline at end of file +html > body div#bodyContent ul { + display: table; +} +html > body div#bodyContent ul#filetoc { + display: block; +} diff --git a/skins/simple/main.css b/skins/simple/main.css index b2c477b8..cc76f522 100644 --- a/skins/simple/main.css +++ b/skins/simple/main.css @@ -117,26 +117,6 @@ table.rimage { text-align:center; } -div.townBox { - position:relative; - float:right; - margin-left:1em; - padding:0.3em; - width: 200px; - overflow: hidden; - clear: right; -} -div.townBox dl { - padding: 0; - margin: 0 0 0.3em 0; -} -div.townBox dl dt { - background: none; - margin: 0.4em 0 0 0; -} -div.townBox dl dd { - margin: 0.1em 0 0 1.1em; -} .portlet { border: none; float: none; @@ -237,6 +217,7 @@ h1.firstHeading, h2 { padding-right: 18px; } #bodyContent a[href ^="irc://"], +#bodyContent a.extiw[href ^="irc://"], .link-irc { background: url("discussionitem_icon.gif") center right no-repeat; padding-right: 18px; @@ -258,16 +239,8 @@ td.diff-deletedline { } .diffchange { background-color: #FFCDF3; text-decoration: none; } -.autocomment { color: grey; } -#pagehistory span.user { - margin-left: 1.4em; - margin-right: 0.4em; -} -#pagehistory span.minor { font-weight: bold; } -#pagehistory li.selected { - background-color:#f9f9f9; - border:1px dashed #aaaaaa; -} +#pagehistory li { border: none; } + span.urlexpansion { display: none; } @@ -347,7 +320,7 @@ a.new, li.new { text-decoration: line-through; } -p.catlinks { +.catlinks { text-align: center; width: 80%; margin-left: auto; @@ -365,16 +338,6 @@ div.printfooter { display: none; } - -#ca-addsection a:before { - content: "Add section"; - font-size: 10pt; -} - -#ca-addsection a { - font-size: 0px; -} - #n-portal, #n-currentevents, #n-help, diff --git a/skins/simple/rtl.css b/skins/simple/rtl.css index 002aa72e..c560caba 100644 --- a/skins/simple/rtl.css +++ b/skins/simple/rtl.css @@ -1,5 +1,5 @@ /* -Right-to-left fixes for MonoBook. +Right-to-left fixes for Simple. Places sidebar on right, tweaks various alignment issues. Works mostly ok nicely on Safari 1.2.1; fine in Mozilla. @@ -24,7 +24,6 @@ To test: */ body { direction: rtl; -/* unicode-bidi: bidi-override;*/ unicode-bidi: embed; } #column-content { @@ -67,7 +66,6 @@ div div.thumbcaption { } div.magnify, -#div.townBox, #p-logo { left: auto; right: 0; @@ -94,14 +92,6 @@ div.tright, div.floatright, table.floatright { div.tleft, div.floatleft, table.floatleft { clear: left; } -div.townBox { - margin-left: 0; - margin-right: 1em; -} -div.townBox dl dd { - margin-left: 0; - margin-right: 1.1em; -} /* Fix link icons */ .external { @@ -161,8 +151,8 @@ input#wpSave, input#wpDiff { float: right; margin: 0 0 1em 3em; } -/* Unblock and Ipblocklist links of Special:Blockip */ -p.mw-ipb-conveniencelinks { +/* Convenience links to edit block and delete reasons */ +p.mw-ipb-conveniencelinks, p.mw-filedelete-editreasons, p.mw-delete-editreasons { float: left; } @@ -173,3 +163,13 @@ p.mw-ipb-conveniencelinks { table.filehistory th { text-align: right; } + +/** + * Lists: + * The following lines don't have a visible effect on non-Gecko browsers + * They fix a problem ith Gecko browsers rendering lists to the right of + * left-floated objects in an RTL layout. + */ +html > body div#bodyContent ul { + display: table; +} |