r66187 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66186‎ | r66187 | r66188 >
Date:11:35, 11 May 2010
Author:aaron
Status:ok
Tags:
Comment:
Switched notice box expansion/collapse to mouseOver behavior
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -301,7 +301,7 @@
302302 $wgAvailableRights[] = 'stablesettings';
303303
304304 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
305 -$wgFlaggedRevStyleVersion = 71;
 305+$wgFlaggedRevStyleVersion = 72;
306306
307307 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
308308
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -295,7 +295,14 @@
296296 $box = '<div class="flaggedrevs_short_basic">' . $shtml .
297297 '&nbsp;' . self::ratingArrow() . "</div>\n";
298298 $box .= '<div style="position: relative;">'; // for rel-absolute child div
299 - $box .= '<div id="mw-fr-revisionratings" class="flaggedrevs_short_details">';
 299+ $box .= Html::openElement( 'div',
 300+ array(
 301+ 'id' => 'mw-fr-revisionratings',
 302+ 'class' => 'flaggedrevs_short_details',
 303+ 'onMouseOver' => 'FlaggedRevs.showBoxDetails()',
 304+ 'onMouseOut' => 'FlaggedRevs.hideBoxDetails()'
 305+ )
 306+ );
300307 $box .= $html; // details text
301308 # Add any rating tags as needed...
302309 if ( $flags && !FlaggedRevs::binaryFlagging() ) {
@@ -304,7 +311,8 @@
305312 $box .= '<p>' . self::addTagRatings( $flags, true, $color ) . '</p>';
306313 }
307314 }
308 - $box .= "</div></div>\n";
 315+ $box .= Html::closeElement( 'div' );
 316+ $box .= "</div>\n";
309317 return $box;
310318 }
311319
@@ -314,11 +322,13 @@
315323 */
316324 public static function ratingArrow() {
317325 $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' );
318 - return "<img id=\"mw-fr-revisiontoggle\" class=\"fr-toggle-arrow\"" .
319 - " src=\"{$encPath}/arrow-up.png\" style=\"display:none;\" " .
320 - " onclick=\"FlaggedRevs.toggleRevRatings()\" title=\"" .
321 - wfMsgHtml( 'revreview-toggle-title' ) . "\" alt=\"" .
322 - wfMsgHtml( 'revreview-toggle-show' ) . "\" />";
 326+ $img = '<img id="mw-fr-revisiontoggle" class="fr-toggle-arrow"';
 327+ $img .= " src=\"{$encPath}/arrow-down.png\" style=\"display:none;\"";
 328+ $img .= ' onMouseOver="FlaggedRevs.showBoxDetails()"';
 329+ $img .= ' onMouseOut="FlaggedRevs.hideBoxDetails()"';
 330+ $img .= ' title="' . wfMsgHtml( 'revreview-toggle-title' ) . '"';
 331+ $img .= ' alt="' . wfMsgHtml( 'revreview-toggle-show' ) . '" />';
 332+ return $img;
323333 }
324334
325335 /**
@@ -327,7 +337,7 @@
328338 */
329339 public static function ratingToggle() {
330340 return '<a id="mw-fr-revisiontoggle" class="fr-toggle-symbol"' .
331 - ' style="display:none;" onclick="FlaggedRevs.toggleRevRatings()" title="' .
 341+ ' style="display:none;" onclick="FlaggedRevs.toggleBoxDetails()" title="' .
332342 wfMsgHtml( 'revreview-toggle-title' ) . '" >' .
333343 wfMsgHtml( 'revreview-toggle-show' ) . '</a>';
334344 }
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -15,6 +15,7 @@
1616 },
1717 /* Hide rating/diff clutter */
1818 'enableShowhide': function() {
 19+ // Rating detail box
1920 var toggle = document.getElementById('mw-fr-revisiontoggle');
2021 if( toggle ) {
2122 toggle.style.display = 'inline';
@@ -23,6 +24,7 @@
2425 ratings.style.display = 'none';
2526 }
2627 }
 28+ // Diff detail box
2729 toggle = document.getElementById('mw-fr-difftoggle');
2830 if( toggle ) {
2931 toggle.style.display = 'inline';
@@ -31,6 +33,7 @@
3234 diff.style.display = 'none';
3335 }
3436 }
 37+ // Log detail box
3538 toggle = document.getElementById('mw-fr-logtoggle');
3639 if( toggle ) {
3740 toggle.style.display = 'inline';
@@ -41,30 +44,36 @@
4245 }
4346 },
4447
45 - /* Toggles ratings */
46 - 'toggleRevRatings': function() {
 48+ /* Expands ratings */
 49+ 'showBoxDetails': function() {
4750 var ratings = document.getElementById('mw-fr-revisionratings');
4851 if( !ratings ) return;
4952 var toggle = document.getElementById('mw-fr-revisiontoggle');
5053 if( !toggle ) return;
 54+ ratings.style.display = 'block';
 55+ toggle.innerHTML = this.messages.toggleHide;
 56+ },
 57+
 58+ /* Collapses ratings */
 59+ 'hideBoxDetails': function() {
 60+ var ratings = document.getElementById('mw-fr-revisionratings');
 61+ if( !ratings ) return;
 62+ var toggle = document.getElementById('mw-fr-revisiontoggle');
 63+ if( !toggle ) return;
 64+ ratings.style.display = 'none';
 65+ toggle.innerHTML = this.messages.toggleShow;
 66+ },
 67+
 68+ /* Toggles ratings */
 69+ 'toggleBoxDetails': function() {
 70+ var ratings = document.getElementById('mw-fr-revisionratings');
 71+ if( !ratings ) return;
5172 // Collapsed -> expand
5273 if( ratings.style.display == 'none' ) {
53 - ratings.style.display = 'block';
54 - if( toggle.tagName == 'IMG' ) { // arrow
55 - toggle.alt = this.messages.toggleHide; // fallback text
56 - toggle.src = toggle.src.replace( 'arrow-up.png', 'arrow-down.png' );
57 - } else { // text
58 - toggle.innerHTML = this.messages.toggleHide;
59 - }
 74+ this.showBoxDetails();
6075 // Expanded -> collapse
6176 } else {
62 - ratings.style.display = 'none';
63 - if( toggle.tagName == 'IMG' ) { // arrow
64 - toggle.alt = this.messages.toggleShow; // fallback text
65 - toggle.src = toggle.src.replace( 'arrow-down.png', 'arrow-up.png' );
66 - } else { // text
67 - toggle.innerHTML = this.messages.toggleShow;
68 - }
 77+ this.hideBoxDetails();
6978 }
7079 },
7180

Status & tagging log