From 4d4e86ecb2ec1015a66ae7c3722c6d877f9bbd42 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Thu, 5 Oct 2023 21:16:50 +0200 Subject: [PATCH] Use a.mw-file-description to find thumbs a.thumb is no longer outputted when $wgParserEnableLegacyMediaDOM is false (fdd8f864 ), use the new class from 350721cc Bug: T348275 Change-Id: I5ec67accab4e1cbfa90544087750016e1baab85d --- resources/mmv.bootstrap/mmv.bootstrap.js | 3 ++- resources/mmv.head/mmv.head.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/mmv.bootstrap/mmv.bootstrap.js b/resources/mmv.bootstrap/mmv.bootstrap.js index 8806c6d87..8e3e9bf5a 100644 --- a/resources/mmv.bootstrap/mmv.bootstrap.js +++ b/resources/mmv.bootstrap/mmv.bootstrap.js @@ -188,6 +188,7 @@ const HtmlUtils = require( './mmv.HtmlUtils.js' ); this.$thumbs = $content.find( '.gallery .image img, ' + 'a.image img, ' + + 'a.mw-file-description img, ' + '#file a img' ); @@ -268,7 +269,7 @@ const HtmlUtils = require( './mmv.HtmlUtils.js' ); processThumb( thumb ) { let title; const $thumb = $( thumb ); - const $link = $thumb.closest( 'a.image' ); + const $link = $thumb.closest( 'a.image, a.mw-file-description' ); const $thumbContainer = $link.closest( '.thumb' ); const $enlarge = $thumbContainer.find( '.magnify a' ); const link = $link.prop( 'href' ); diff --git a/resources/mmv.head/mmv.head.js b/resources/mmv.head/mmv.head.js index 77da5a0d2..692498924 100644 --- a/resources/mmv.head/mmv.head.js +++ b/resources/mmv.head/mmv.head.js @@ -31,7 +31,7 @@ module.exports = base; return; } - $document.on( 'click.mmv-head', 'a.image', ( e ) => { + $document.on( 'click.mmv-head', 'a.image, a.mw-file-description', ( e ) => { // Do not interfere with non-left clicks or if modifier keys are pressed. // Also, make sure we do not get in a loop. if ( ( e.button !== 0 && e.which !== 1 ) || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey || e.replayed ) {