dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Gallery slideshow: Fix height calculation
[lhc/web/wiklou.git]
/
resources
/
src
/
mediawiki.page.gallery.slideshow.js
diff --git
a/resources/src/mediawiki.page.gallery.slideshow.js
b/resources/src/mediawiki.page.gallery.slideshow.js
index
6e9ff0e
..
71b3dfe
100644
(file)
--- a/
resources/src/mediawiki.page.gallery.slideshow.js
+++ b/
resources/src/mediawiki.page.gallery.slideshow.js
@@
-1,7
+1,7
@@
/*!
* mw.GallerySlideshow: Interface controls for the slideshow gallery
*/
/*!
* mw.GallerySlideshow: Interface controls for the slideshow gallery
*/
-( function (
mw, $, OO
) {
+( function () {
/**
* mw.GallerySlideshow encapsulates the user interface of the slideshow
* galleries. An object is instantiated for each `.mw-gallery-slideshow`
/**
* mw.GallerySlideshow encapsulates the user interface of the slideshow
* galleries. An object is instantiated for each `.mw-gallery-slideshow`
@@
-19,9
+19,6
@@
this.$galleryBox = this.$gallery.find( '.gallerybox' );
this.$currentImage = null;
this.imageInfoCache = {};
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();
// Initialize
this.drawCarousel();
@@
-87,11
+84,6
@@
* @property {jQuery} $currentImage The `<li>` element of the current image.
*/
* @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.
*/
/**
* @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 () {
* 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 = $( '<li>' ).addClass( 'gallerycarousel' );
this.$carousel = $( '<li>' ).addClass( 'gallerycarousel' );
@@
-185,15
+177,8
@@
* size.
*/
mw.GallerySlideshow.prototype.setSizeRequirement = function () {
* 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();
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 ) {
// 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 {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
*
* @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();
*/
mw.GallerySlideshow.prototype.loadImage = function ( $img ) {
var img, d = $.Deferred();
@@
-457,4
+442,4
@@
new mw.GallerySlideshow( this );
} );
} );
new mw.GallerySlideshow( this );
} );
} );
-}(
mediaWiki, jQuery, OO
) );
+}() );