// Initialize
this.drawCarousel();
this.setSizeRequirement();
- this.toggleThumbnails( false );
+ this.toggleThumbnails( !!this.$gallery.attr( 'data-showthumbnails' ) );
this.showCurrentImage();
// Events
toggle = new OO.ui.ButtonWidget( {
framed: false,
- icon: 'imageGallery'
+ icon: 'imageGallery',
+ title: mw.msg( 'gallery-slideshow-toggle' )
} ).on( 'click', this.toggleThumbnails.bind( this ) );
interfaceElements = new OO.ui.PanelLayout( {
/**
* Gets the height of the interface elements and the
* gallery's caption.
+ *
+ * @return {number} Height
*/
mw.GallerySlideshow.prototype.getChromeHeight = function () {
return this.$interface.outerHeight() + this.$galleryCaption.outerHeight();
// Show thumbnail stretched to the right size while the image loads
this.$thumbnail = imageLi.find( 'img' );
this.$img.attr( 'src', this.$thumbnail.attr( 'src' ) );
+ this.$img.attr( 'alt', this.$thumbnail.attr( 'alt' ) );
this.$imgLink.attr( 'href', imageLi.find( 'a' ).eq( 0 ).attr( 'href' ) );
this.setImageSize();
if ( this.imageInfoCache[ imageSrc ] === undefined ) {
api = new mw.Api();
// TODO: This supports only gallery of images
- title = new mw.Title.newFromImg( $img );
+ title = mw.Title.newFromImg( $img );
params = {
action: 'query',
formatversion: 2,
};
// Bootstrap all slideshow galleries
- $( function () {
- $( '.mw-gallery-slideshow' ).each( function () {
- /*jshint -W031 */
+ mw.hook( 'wikipage.content' ).add( function ( $content ) {
+ $content.find( '.mw-gallery-slideshow' ).each( function () {
+ // eslint-disable-next-line no-new
new mw.GallerySlideshow( this );
- /*jshint +W031 */
} );
} );
}( mediaWiki, jQuery, OO ) );