X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.page.gallery.slideshow.js;h=71b3dfe6e1ec73a44b95b901276ee6bb9396403f;hb=89495c542241c45985919a125dafa0d4f2965a97;hp=204d9154abce865d8fac424c95ddbb1203a0dea9;hpb=95bbac065507e69b1cbfbdd38b0a3b55eadc1a4c;p=lhc%2Fweb%2Fwiklou.git
diff --git a/resources/src/mediawiki.page.gallery.slideshow.js b/resources/src/mediawiki.page.gallery.slideshow.js
index 204d9154ab..71b3dfe6e1 100644
--- a/resources/src/mediawiki.page.gallery.slideshow.js
+++ b/resources/src/mediawiki.page.gallery.slideshow.js
@@ -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();
@@ -87,11 +84,6 @@
* @property {jQuery} $currentImage The `
` 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.
*/
@@ -113,7 +105,7 @@
* Draws the carousel and the interface around it.
*/
mw.GallerySlideshow.prototype.drawCarousel = function () {
- var next, prev, toggle, interfaceElements, carouselStack;
+ var next, prev, toggle, interfaceElements, carouselStack;
this.$carousel = $( '' ).addClass( 'gallerycarousel' );
@@ -185,15 +177,8 @@
* 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 ) {
@@ -211,7 +196,7 @@
* @return {number} Height
*/
mw.GallerySlideshow.prototype.getChromeHeight = function () {
- return this.$interface.outerHeight() + this.$galleryCaption.outerHeight();
+ return this.$interface.outerHeight() + ( this.$galleryCaption.outerHeight() || 0 );
};
/**
@@ -297,7 +282,7 @@
*
* @param {Object} $img
* @return {jQuery.Promise} Resolves with the images URL and original
- * element once the image has loaded.
+ * element once the image has loaded.
*/
mw.GallerySlideshow.prototype.loadImage = function ( $img ) {
var img, d = $.Deferred();