M4tx has uploaded a new change for review. https://gerrit.wikimedia.org/r/182130
Change subject: More accurate looking for image caption ...................................................................... More accurate looking for image caption MediaViewer now handles Template:Multiple_image. Instead of looking for caption in whole thumbnail container, it tries to find the closest one to the image. Bug: T85354 Change-Id: I18d982a4bf245c4925213d83a3410274d499845e --- M resources/mmv/mmv.bootstrap.js 1 file changed, 8 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/30/182130/1 diff --git a/resources/mmv/mmv.bootstrap.js b/resources/mmv/mmv.bootstrap.js index 4efd48d..d18b4ba 100644 --- a/resources/mmv/mmv.bootstrap.js +++ b/resources/mmv/mmv.bootstrap.js @@ -326,7 +326,14 @@ var $thumbCaption; if ( $thumbContain.length !== 0 && $thumbContain.is( '.thumb' ) ) { - $thumbCaption = $thumbContain.find( '.thumbcaption' ).clone(); + // try to find closest caption to the image + $thumbCaption = $link.closest( ':has(> .thumbcaption)', $thumbContain ) + .find( '> .thumbcaption' ) + .clone(); + if ( !$thumbCaption.length ) { + // if nothing is found, look for the caption in whole container + $thumbCaption = $thumbContain.find( '.thumbcaption' ).clone(); + } $thumbCaption.find( '.magnify' ).remove(); if ( !$thumbCaption.length ) { // gallery, maybe $thumbCaption = $thumbContain -- To view, visit https://gerrit.wikimedia.org/r/182130 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18d982a4bf245c4925213d83a3410274d499845e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: M4tx <m...@m4tx.pl> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits