Make giant table sticky captions js only affect giant tables

Well, that was thoroughly dumb.

Bug: T271473
Bug: T271501
Change-Id: I73b5d5954ba3dbdd0630347efe488311a498bd27
isekai
Isarra 4 years ago
parent cf4d6b98b4
commit 0d689de072

@ -103,15 +103,18 @@ mw.hook( 'wikipage.content' ).add( function ( $content ) {
// Set up sticky captions
$content.find( '.content-table > table > caption' ).each( function () {
var $container, tableHeight;
$container = $( this ).parents( '.content-table-wrapper' );
$( this ).width( $content.width() );
tableHeight = $container.innerHeight() - $( this ).outerHeight();
var $container, tableHeight,
$table = $( this ).parent(),
$wrapper = $table.parent().parent();
$container.find( '.content-table-left' ).height( tableHeight );
$container.find( '.content-table-right' ).height( tableHeight );
if ( $table.outerWidth() > $wrapper.outerWidth() ) {
$container = $( this ).parents( '.content-table-wrapper' );
$( this ).width( $content.width() );
tableHeight = $container.innerHeight() - $( this ).outerHeight();
$container.find( '.content-table-left' ).height( tableHeight );
$container.find( '.content-table-right' ).height( tableHeight );
}
} );
}

Loading…
Cancel
Save