Support mw:File as well as mw:Image

Bug: T273505
Change-Id: I5734593936e620b4c74789080263ef1ea3b99c9d
This commit is contained in:
Arlo Breault 2022-05-19 17:46:46 -04:00
parent f13d696748
commit 65cba344ad

View file

@ -156,6 +156,9 @@
); );
this.$parsoidThumbs = $content.find( this.$parsoidThumbs = $content.find(
'[typeof*="mw:File"] a.mw-file-description img, ' +
// TODO: Remove mw:Image when version 2.4.0 of the content is no
// longer supported
'[typeof*="mw:Image"] a.mw-file-description img' '[typeof*="mw:Image"] a.mw-file-description img'
); );
@ -298,7 +301,12 @@
var bs = this, var bs = this,
$thumb = $( thumb ), $thumb = $( thumb ),
$link = $thumb.closest( 'a.mw-file-description' ), $link = $thumb.closest( 'a.mw-file-description' ),
$thumbContainer = $link.closest( '[typeof*="mw:Image"]' ), $thumbContainer = $link.closest(
'[typeof*="mw:File"], ' +
// TODO: Remove mw:Image when version 2.4.0 of the content is
// no longer supported
'[typeof*="mw:Image"]'
),
link = $link.prop( 'href' ), link = $link.prop( 'href' ),
alt = $thumb.attr( 'alt' ), alt = $thumb.attr( 'alt' ),
title = mw.Title.newFromImg( $thumb ); title = mw.Title.newFromImg( $thumb );
@ -512,7 +520,13 @@
mw.mmv.durationLogger.start( [ 'click-to-first-image', 'click-to-first-metadata' ] ); mw.mmv.durationLogger.start( [ 'click-to-first-image', 'click-to-first-metadata' ] );
if ( $element.is( 'a.image, [typeof*="mw:Image"] > a' ) ) { if ( $element.is(
'a.image, ' +
'[typeof*="mw:File"] a.mw-file-description, ' +
// TODO: Remove mw:Image when version 2.4.0 of the content is no
// longer supported
'[typeof*="mw:Image"] a.mw-file-description'
) ) {
mw.mmv.actionLogger.log( 'thumbnail' ); mw.mmv.actionLogger.log( 'thumbnail' );
} else if ( $element.is( '.magnify a' ) ) { } else if ( $element.is( '.magnify a' ) ) {
mw.mmv.actionLogger.log( 'enlarge' ); mw.mmv.actionLogger.log( 'enlarge' );