Gallery slideshow: Fix height calculation
[lhc/web/wiklou.git] / resources / src / mediawiki.page.gallery.slideshow.js
index 17caa9e..71b3dfe 100644 (file)
@@ -19,9 +19,6 @@
                this.$galleryBox = this.$gallery.find( '.gallerybox' );
                this.$currentImage = null;
                this.imageInfoCache = {};
-               if ( this.$gallery.parent().attr( 'id' ) !== 'mw-content-text' ) {
-                       this.$container = this.$gallery.parent();
-               }
 
                // Initialize
                this.drawCarousel();
         * @property {jQuery} $currentImage The `<li>` element of the current image.
         */
 
-       /**
-        * @property {jQuery} $container If the gallery contained in an element that is
-        *   not the main content element, then it stores that element.
-        */
-
        /**
         * @property {Object} imageInfoCache A key value pair of thumbnail URLs and image info.
         */
         * size.
         */
        mw.GallerySlideshow.prototype.setSizeRequirement = function () {
-               var w, h;
-
-               if ( this.$container !== undefined ) {
-                       w = this.$container.width() * 0.9;
-                       h = ( this.$container.height() - this.getChromeHeight() ) * 0.9;
-               } else {
-                       w = this.$imgContainer.width();
+               var w = this.$imgContainer.width(),
                        h = Math.min( $( window ).height() * ( 3 / 4 ), this.$imgContainer.width() ) - this.getChromeHeight();
-               }
 
                // Only update and flush the cache if the size changed
                if ( w !== this.imageWidth || h !== this.imageHeight ) {
         * @return {number} Height
         */
        mw.GallerySlideshow.prototype.getChromeHeight = function () {
-               return this.$interface.outerHeight() + this.$galleryCaption.outerHeight();
+               return this.$interface.outerHeight() + ( this.$galleryCaption.outerHeight() || 0 );
        };
 
        /**