https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112457

Revision: 112457
Author:   krinkle
Date:     2012-02-27 00:03:14 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
[mediawik.special.changeslist] Remove ugly arrow swapping hack
* Use CSS and change the background image, instead of displaying 2 <img> tags 
and hiding one based on the parent element's class
* touches bug 17616 a bit, although it doesn't address the focus issue yet, but 
does improve the overal structure of this module
* Also speeds up by:
- Outputting less markup
- Having 1 embedded images in the CSS file instead of (N changes)*<img> tags
* jquery.makeCollapsible:

Modified Paths:
--------------
    trunk/phase3/includes/ChangesList.php
    trunk/phase3/resources/mediawiki.special/mediawiki.special.changeslist.css

Added Paths:
-----------
    trunk/phase3/resources/mediawiki.special/images/
    trunk/phase3/resources/mediawiki.special/images/arrow-collapsed-ltr.png
    trunk/phase3/resources/mediawiki.special/images/arrow-collapsed-rtl.png
    trunk/phase3/resources/mediawiki.special/images/arrow-expanded.png

Modified: trunk/phase3/includes/ChangesList.php
===================================================================
--- trunk/phase3/includes/ChangesList.php       2012-02-26 23:47:22 UTC (rev 
112456)
+++ trunk/phase3/includes/ChangesList.php       2012-02-27 00:03:14 UTC (rev 
112457)
@@ -860,16 +860,7 @@
                $users = ' <span class="changedby">[' .
                        implode( $this->message['semicolon-separator'], $users 
) . ']</span>';
 
-               # Title for <a> tags
-               $expandTitle = htmlspecialchars( wfMsg( 'rc-enhanced-expand' ) 
);
-               $closeTitle = htmlspecialchars( wfMsg( 'rc-enhanced-hide' ) );
-
-               $tl = "<span class='mw-collapsible-toggle'>"
-                       . "<span class='mw-rc-openarrow'>"
-                       . "<a href='#' 
title='$expandTitle'>{$this->sideArrow()}</a>"
-                       . "</span><span class='mw-rc-closearrow'>"
-                       . "<a href='#' 
title='$closeTitle'>{$this->downArrow()}</a>"
-                       . "</span></span>";
+               $tl = '<span class="mw-collapsible-toggle 
mw-enhancedchanges-arrow"></span>';
                $r .= "<td>$tl</td>";
 
                # Main line
@@ -974,7 +965,6 @@
                        $classes = array();
                        $type = $rcObj->mAttribs['rc_type'];
 
-                       #$r .= '<tr><td valign="top">'.$this->spacerArrow();
                        $r .= '<tr><td></td><td class="mw-enhanced-rc">';
                        $r .= $this->recentChangesFlags( array(
                                'newpage' => $rcObj->mAttribs['rc_new'],
@@ -1119,7 +1109,7 @@
                $r = Html::openElement( 'table', array( 'class' => $classes ) ) 
.
                        Html::openElement( 'tr' );
 
-               $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow();
+               $r .= '<td class="mw-enhanced-rc"><span 
class="mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
                # Flag and Timestamp
                if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
                        $r .= '&#160;&#160;&#160;&#160;'; // 4 flags -> 4 spaces

Copied: trunk/phase3/resources/mediawiki.special/images/arrow-collapsed-ltr.png 
(from rev 112446, trunk/phase3/skins/common/images/Arr_r.png)
===================================================================
(Binary files differ)

Copied: trunk/phase3/resources/mediawiki.special/images/arrow-collapsed-rtl.png 
(from rev 112446, trunk/phase3/skins/common/images/Arr_l.png)
===================================================================
(Binary files differ)

Copied: trunk/phase3/resources/mediawiki.special/images/arrow-expanded.png 
(from rev 112446, trunk/phase3/skins/common/images/Arr_d.png)
===================================================================
(Binary files differ)

Modified: 
trunk/phase3/resources/mediawiki.special/mediawiki.special.changeslist.css
===================================================================
--- trunk/phase3/resources/mediawiki.special/mediawiki.special.changeslist.css  
2012-02-26 23:47:22 UTC (rev 112456)
+++ trunk/phase3/resources/mediawiki.special/mediawiki.special.changeslist.css  
2012-02-27 00:03:14 UTC (rev 112457)
@@ -31,20 +31,29 @@
        float: none;
 }
 
-/**
- * If JS is disabled, the arrow is still needed
- * for spacing, but ideally shouldn't be shown
- */
-.mw-enhanced-rc .mw-rc-openarrow {
-       visibility: hidden;
+/* If JS is disabled, the arrow shouldn't be shown */
+.client-nojs .mw-enhancedchanges-arrow.mw-collapsible-toggle {
+       display: none;
 }
 
-.mw-enhanced-rc.mw-made-collapsible .mw-rc-openarrow,
-.mw-enhanced-rc .mw-rc-closearrow {
-       visibility: visible;
-       display: none;
+.mw-enhancedchanges-arrow {
+       display: inline-block;
+       *display: inline; /* IE7 and below */
+       zoom: 1;
+       width: 15px;
+       height: 15px;
 }
-.mw-enhanced-rc.mw-made-collapsible .mw-collapsible-toggle-collapsed 
.mw-rc-openarrow,
-.mw-enhanced-rc.mw-made-collapsible .mw-collapsible-toggle-expanded 
.mw-rc-closearrow {
-       display: inline;
+
+.mw-enhancedchanges-arrow.mw-enhancedchanges-arrow-space {
+       background: none;
 }
+
+.mw-enhancedchanges-arrow.mw-collapsible-toggle-collapsed {
+       /* @embed */
+       background: url(images/arrow-collapsed-ltr.png) no-repeat left center;
+}
+
+.mw-enhancedchanges-arrow.mw-collapsible-toggle-expanded {
+       /* @embed */
+       background: url(images/arrow-expanded.png) no-repeat left center;
+}


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to