From efa3c7268bce10c46d84e8ee83dfe0238c3b583e Mon Sep 17 00:00:00 2001 From: m4tx Date: Fri, 9 Jan 2015 22:59:51 +0100 Subject: [PATCH] Fix gallery rearrange on resize with missing images Follow-ups I286e0a4c8230c11619ca30f8f3b66778de835a33 Bug: T55664 Change-Id: I95cc64de11df3197378f4873d62a76333d55b452 --- resources/src/mediawiki.page/mediawiki.page.gallery.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/src/mediawiki.page/mediawiki.page.gallery.js b/resources/src/mediawiki.page/mediawiki.page.gallery.js index e3ffbdacb3..e4cd3a23c4 100644 --- a/resources/src/mediawiki.page/mediawiki.page.gallery.js +++ b/resources/src/mediawiki.page/mediawiki.page.gallery.js @@ -222,12 +222,14 @@ imgHeight = $( this ).data( 'imgHeight' ), width = $( this ).data( 'width' ), captionWidth = $( this ).data( 'captionWidth' ), + $innerDiv = $( this ).children( 'div' ).first(), + $imageDiv = $innerDiv.children( 'div.thumb' ), $imageElm, imageElm; // Restore original sizes so we can arrange the elements as on freshly loaded page $( this ).width( width ); - $( this ).children( 'div' ).first().width( width ); - $( this ).children( 'div' ).first().children( 'div.thumb' ).width( imgWidth ); + $innerDiv.width( width ); + $imageDiv.width( imgWidth ); $( this ).find( 'div.gallerytextwrapper' ).width( captionWidth ); $imageElm = $( this ).find( 'img' ).first(); @@ -235,6 +237,8 @@ if ( imageElm ) { imageElm.width = imgWidth; imageElm.height = imgHeight; + } else { + $imageDiv.height( imgHeight ); } } ); } ) ); -- 2.20.1