mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
s/thumbContain/thumbContainer/
Change-Id: I57738c705b3be7aade3e5ba64c879eecc1727383
This commit is contained in:
parent
ed053a394a
commit
681e1afe36
|
@ -196,8 +196,8 @@
|
||||||
bs = this,
|
bs = this,
|
||||||
$thumb = $( thumb ),
|
$thumb = $( thumb ),
|
||||||
$link = $thumb.closest( 'a.image, [typeof*="mw:Image"] > a' ),
|
$link = $thumb.closest( 'a.image, [typeof*="mw:Image"] > a' ),
|
||||||
$thumbContain = $link.closest( '.thumb, [typeof*="mw:Image"]' ),
|
$thumbContainer = $link.closest( '.thumb, [typeof*="mw:Image"]' ),
|
||||||
$enlarge = $thumbContain.find( '.magnify a' ),
|
$enlarge = $thumbContainer.find( '.magnify a' ),
|
||||||
link = $link.prop( 'href' ),
|
link = $link.prop( 'href' ),
|
||||||
alt = $thumb.attr( 'alt' ),
|
alt = $thumb.attr( 'alt' ),
|
||||||
isFilePageMainThumb = $thumb.closest( '#file' ).length > 0;
|
isFilePageMainThumb = $thumb.closest( '#file' ).length > 0;
|
||||||
|
@ -222,9 +222,9 @@
|
||||||
return;
|
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)
|
// 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 () {
|
mouseenter: function () {
|
||||||
// There is no point preloading if clicking the thumb won't open Media Viewer
|
// There is no point preloading if clicking the thumb won't open Media Viewer
|
||||||
if ( !bs.config.isMediaViewerEnabledOnClick() ) {
|
if ( !bs.config.isMediaViewerEnabledOnClick() ) {
|
||||||
|
@ -254,7 +254,7 @@
|
||||||
title: title,
|
title: title,
|
||||||
link: link,
|
link: link,
|
||||||
alt: alt,
|
alt: alt,
|
||||||
caption: this.findCaption( $thumbContain, $link ) } );
|
caption: this.findCaption( $thumbContainer, $link ) } );
|
||||||
|
|
||||||
$link.add( $enlarge ).on( 'click', function ( e ) {
|
$link.add( $enlarge ).on( 'click', function ( e ) {
|
||||||
return bs.click( this, e, title );
|
return bs.click( this, e, title );
|
||||||
|
@ -378,33 +378,33 @@
|
||||||
/**
|
/**
|
||||||
* Finds the caption for an image.
|
* 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.
|
* @param {jQuery} $link The link that encompasses the thumbnail.
|
||||||
* @return {string|undefined} Unsafe HTML may be present - caution
|
* @return {string|undefined} Unsafe HTML may be present - caution
|
||||||
*/
|
*/
|
||||||
MMVB.findCaption = function ( $thumbContain, $link ) {
|
MMVB.findCaption = function ( $thumbContainer, $link ) {
|
||||||
var $thumbCaption, $potentialCaptions;
|
var $thumbCaption, $potentialCaptions;
|
||||||
|
|
||||||
if ( !$thumbContain.length ) {
|
if ( !$thumbContainer.length ) {
|
||||||
return $link.prop( 'title' ) || undefined;
|
return $link.prop( 'title' ) || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
$potentialCaptions = $thumbContain.find( '.thumbcaption, figcaption' );
|
$potentialCaptions = $thumbContainer.find( '.thumbcaption, figcaption' );
|
||||||
if ( $potentialCaptions.length < 2 ) {
|
if ( $potentialCaptions.length < 2 ) {
|
||||||
$thumbCaption = $potentialCaptions.eq( 0 );
|
$thumbCaption = $potentialCaptions.eq( 0 );
|
||||||
} else {
|
} else {
|
||||||
// Template:Multiple_image or some such; try to find closest caption to the image
|
// Template:Multiple_image or some such; try to find closest caption to the image
|
||||||
// eslint-disable-next-line no-jquery/no-sizzle
|
// eslint-disable-next-line no-jquery/no-sizzle
|
||||||
$thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContain )
|
$thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContainer )
|
||||||
.find( '> .thumbcaption' );
|
.find( '> .thumbcaption' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$thumbCaption.length ) { // gallery, maybe
|
if ( !$thumbCaption.length ) { // gallery, maybe
|
||||||
$thumbCaption = $thumbContain
|
$thumbCaption = $thumbContainer
|
||||||
.closest( '.gallerybox' )
|
.closest( '.gallerybox' )
|
||||||
.not( function () {
|
.not( function () {
|
||||||
// do not treat categories as galleries - the autogenerated caption they have is not helpful
|
// 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 () {
|
.not( function () {
|
||||||
// do not treat special file related pages as galleries
|
// do not treat special file related pages as galleries
|
||||||
|
@ -415,7 +415,7 @@
|
||||||
'.page-Special_UncategorizedFiles, ' +
|
'.page-Special_UncategorizedFiles, ' +
|
||||||
'.page-Special_UnusedFiles'
|
'.page-Special_UnusedFiles'
|
||||||
);
|
);
|
||||||
return $thumbContain.closest( $specialFileRelatedPages ).length;
|
return $thumbContainer.closest( $specialFileRelatedPages ).length;
|
||||||
} )
|
} )
|
||||||
.find( '.gallerytext' );
|
.find( '.gallerytext' );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue