Nikerabbit has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/399421 )
Change subject: Remove deprecated jQuery.fn.hover in stats table
......................................................................
Remove deprecated jQuery.fn.hover in stats table
Also removed the usage of mw-sp-translate-table. That is only
used by Special:Translations now. Instead use statstable class,
while not ideal as unprefixed thing, already exists.
Change-Id: I32466c3653ab39276d13151cfdbfc5060cd91d28
---
M resources/css/ext.translate.special.languagestats.css
M resources/js/ext.translate.special.languagestats.js
M utils/StatsTable.php
3 files changed, 25 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/21/399421/1
diff --git a/resources/css/ext.translate.special.languagestats.css
b/resources/css/ext.translate.special.languagestats.css
index 74d1d4d..0e9a7bb 100644
--- a/resources/css/ext.translate.special.languagestats.css
+++ b/resources/css/ext.translate.special.languagestats.css
@@ -1,4 +1,4 @@
-.mw-sp-translate-table.wikitable tr:hover td {
+.statstable tr:hover td {
background: #fff;
}
diff --git a/resources/js/ext.translate.special.languagestats.js
b/resources/js/ext.translate.special.languagestats.js
index b0b1a54..1f63edd 100644
--- a/resources/js/ext.translate.special.languagestats.js
+++ b/resources/js/ext.translate.special.languagestats.js
@@ -10,7 +10,7 @@
$( function () {
var $allChildRows, $allTogglesCache, $toggleAllButton,
- $translateTable = $( '.mw-sp-translate-table' ),
+ $translateTable = $( '.statstable' ),
$metaRows = $( 'tr.AggregateMessageGroup',
$translateTable );
// Quick return
@@ -104,27 +104,30 @@
$( function () {
// It is possible that the first event we get is
hover-out, in
// which case the colors will get stuck wrong. Ignore
it.
- var seenHoverIn = false;
+ var eventHandlers, seenHoverIn = false;
- $( '.mw-sp-translate-table.wikitable tr' ).hover(
function () {
- seenHoverIn = true;
- $( '> td.hover-color', this )
- // 30% more brightness
- .css( 'background-color', function ( i,
val ) {
- // @codingStandardsIgnoreStart
Bug in CodeSniffer?
- return
$.colorUtil.getColorBrightness( val, +0.3 );
- // codingStandardsIgnoreEnd
- } );
- }, function () {
- if ( !seenHoverIn ) {
- return;
+ eventHandlers = {
+ mouseenter: function () {
+ seenHoverIn = true;
+ $( this ).children( '.hover-color' )
+ // 30% more brightness
+ .css( 'background-color',
function ( i, val ) {
+ return
$.colorUtil.getColorBrightness( val, +0.3 );
+ } );
+ },
+ mouseleave: function () {
+ if ( !seenHoverIn ) {
+ return;
+ }
+ $( this ).children( '.hover-color' )
+ // 30% less brightness
+ .css( 'background-color',
function ( i, val ) {
+ return
$.colorUtil.getColorBrightness( val, -0.3 );
+ } );
}
- $( '> td.hover-color', this )
- // 30% less brightness
- .css( 'background-color', function ( i,
val ) {
- return
$.colorUtil.getColorBrightness( val, -0.3 );
- } );
- } );
+ };
+
+ $( '.statstable' ).on( eventHandlers, 'tr' );
} );
} );
diff --git a/utils/StatsTable.php b/utils/StatsTable.php
index ecd9c2a..877fdd2 100644
--- a/utils/StatsTable.php
+++ b/utils/StatsTable.php
@@ -147,7 +147,7 @@
// Create table header
$out = Html::openElement(
'table',
- [ 'class' => 'statstable wikitable
mw-sp-translate-table' ]
+ [ 'class' => 'statstable wikitable' ]
);
$out .= "\n\t" . Html::openElement( 'thead' );
--
To view, visit https://gerrit.wikimedia.org/r/399421
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I32466c3653ab39276d13151cfdbfc5060cd91d28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits