+
+ // We are adding and changing cells in a table that, despite having nested rows,
+ // is actually all one big table. To prevent the highlights cell in the "nested"
+ // rows from stretching out the cell with the flags and timestamp in the top row,
+ // we give the latter colspan=2. Then to make things line up again, we add
+ // an empty <td> to the "nested" rows.
+
+ // Set colspan=2 on cell with flags and timestamp in top row
+ $content.find( 'table.mw-enhanced-rc tr:first-child td.mw-enhanced-rc' )
+ .prop( 'colspan', '2' );
+ // Add empty <td> to nested rows to compensate
+ $enhancedNestedPagesCell.parent().prepend( $( '<td>' ) );
+ // Add highlights cell to nested rows
+ $enhancedNestedPagesCell
+ .before(
+ $( '<td>' )
+ .append( $highlights.clone().addClass( 'mw-enhanced-rc-nested' ) )
+ );
+
+ // We need to target the nested rows differently than the top rows so that the
+ // LESS rules applies correctly. In top rows, the rule should highlight all but
+ // the first 2 cells td:not( :nth-child( -n+2 ) and the nested rows, the rule
+ // should highlight all but the first 4 cells td:not( :nth-child( -n+4 )
+ $enhancedNestedPagesCell
+ .closest( 'tr' )
+ .addClass( 'mw-rcfilters-ui-changesListWrapperWidget-enhanced-nested' );
+
+ // Go over pages that have sub results
+ // HACK: We really only can collect those by targetting the collapsible class
+ $enhancedTopPageCell.each( function () {
+ var collectedClasses,
+ $table = $( this );
+
+ // Go over <tr>s and pick up all recognized classes
+ collectedClasses = widget.getHighlightClasses().filter( function ( className ) {
+ return $table.find( 'tr' ).hasClass( className );
+ } );
+
+ $table.find( 'tr:first-child' )
+ .addClass( collectedClasses.join( ' ' ) );
+ } );
+
+ $content.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-enhancedView' );