s/thumbContain/thumbContainer/

Change-Id: I57738c705b3be7aade3e5ba64c879eecc1727383
This commit is contained in:
Arlo Breault 2022-03-04 18:34:06 -05:00
parent ed053a394a
commit 681e1afe36

View file

@ -196,8 +196,8 @@
bs = this,
$thumb = $( thumb ),
$link = $thumb.closest( 'a.image, [typeof*="mw:Image"] > a' ),
$thumbContain = $link.closest( '.thumb, [typeof*="mw:Image"]' ),
$enlarge = $thumbContain.find( '.magnify a' ),
$thumbContainer = $link.closest( '.thumb, [typeof*="mw:Image"]' ),
$enlarge = $thumbContainer.find( '.magnify a' ),
link = $link.prop( 'href' ),
alt = $thumb.attr( 'alt' ),
isFilePageMainThumb = $thumb.closest( '#file' ).length > 0;
@ -222,9 +222,9 @@
return;
}
if ( $thumbContain.length ) {
if ( $thumbContainer.length ) {
// If this is a thumb, we preload JS/CSS when the mouse cursor hovers the thumb container (thumb image + caption + border)
$thumbContain.on( {
$thumbContainer.on( {
mouseenter: function () {
// There is no point preloading if clicking the thumb won't open Media Viewer
if ( !bs.config.isMediaViewerEnabledOnClick() ) {
@ -254,7 +254,7 @@
title: title,
link: link,
alt: alt,
caption: this.findCaption( $thumbContain, $link ) } );
caption: this.findCaption( $thumbContainer, $link ) } );
$link.add( $enlarge ).on( 'click', function ( e ) {
return bs.click( this, e, title );
@ -378,33 +378,33 @@
/**
* Finds the caption for an image.
*
* @param {jQuery} $thumbContain The container for the thumbnail.
* @param {jQuery} $thumbContainer The container for the thumbnail.
* @param {jQuery} $link The link that encompasses the thumbnail.
* @return {string|undefined} Unsafe HTML may be present - caution
*/
MMVB.findCaption = function ( $thumbContain, $link ) {
MMVB.findCaption = function ( $thumbContainer, $link ) {
var $thumbCaption, $potentialCaptions;
if ( !$thumbContain.length ) {
if ( !$thumbContainer.length ) {
return $link.prop( 'title' ) || undefined;
}
$potentialCaptions = $thumbContain.find( '.thumbcaption, figcaption' );
$potentialCaptions = $thumbContainer.find( '.thumbcaption, figcaption' );
if ( $potentialCaptions.length < 2 ) {
$thumbCaption = $potentialCaptions.eq( 0 );
} else {
// Template:Multiple_image or some such; try to find closest caption to the image
// eslint-disable-next-line no-jquery/no-sizzle
$thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContain )
$thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContainer )
.find( '> .thumbcaption' );
}
if ( !$thumbCaption.length ) { // gallery, maybe
$thumbCaption = $thumbContain
$thumbCaption = $thumbContainer
.closest( '.gallerybox' )
.not( function () {
// do not treat categories as galleries - the autogenerated caption they have is not helpful
return $thumbContain.closest( '#mw-category-media' ).length;
return $thumbContainer.closest( '#mw-category-media' ).length;
} )
.not( function () {
// do not treat special file related pages as galleries
@ -415,7 +415,7 @@
'.page-Special_UncategorizedFiles, ' +
'.page-Special_UnusedFiles'
);
return $thumbContain.closest( $specialFileRelatedPages ).length;
return $thumbContainer.closest( $specialFileRelatedPages ).length;
} )
.find( '.gallerytext' );
}