r79688 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79687‎ | r79688 | r79689 >
Date:23:41, 5 January 2011
Author:krinkle
Status:deferred
Tags:
Comment:
The last two cells (indicating the progress by green-to-red representation of percentages) have inline styling for the background. They won't be (and, if better is possible shouldn't be) made white by translate.langstats.css on-hover.
Instead use the new jquery.colorUtil to make the brightness 30% higher when it's hovered.
Modified paths:
  • /trunk/extensions/Translate/js/translate.langstats.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/js/translate.langstats.js
@@ -68,4 +68,29 @@
6969 // Add the toggle-all button above the table
7070 $( '<p class="mw-sp-langstats-toggleall"></p>' ).append( $toggleAllButton ).insertBefore( $translateTable );
7171 }
 72+} );
 73+
 74+// When hovering a row, adjust brightness of the last two custom-colored cells as well
 75+// See also translate.langstats.css for the highlighting for the other normal rows
 76+mediaWiki.loader.using( 'jquery.colorUtil' , function() {
 77+
 78+ $( '.mw-sp-translate-table.wikitable tr' ).hover( function() {
 79+
 80+ $( '> td:last', this )
 81+ // Get last two cells
 82+ .prev( 'td' ).andSelf()
 83+ // 30% more brightness
 84+ .css( 'background-color', function( i, val ) {
 85+ return $.colorUtil.getColorBrightness( val, +0.3 );
 86+ } );
 87+ }, function() {
 88+ $( '> td:last', this )
 89+ // Get last two cells
 90+ .prev( 'td' ).andSelf()
 91+ // 30% less brightness
 92+ .css( 'background-color', function( i, val ) {
 93+ return $.colorUtil.getColorBrightness( val, -0.3 );
 94+ } );
 95+ } );
 96+
7297 } );
\ No newline at end of file

Status & tagging log