From: Timo Tijhof Date: Mon, 21 May 2018 16:52:13 +0000 (+0100) Subject: mediawiki.page.gallery: Improve documentation X-Git-Tag: 1.34.0-rc.0~5353^2 X-Git-Url: https://git.cyclocoop.org/%27%20.%20%24this-%3EgetSkin%28%29-%3EescapeSearchLink%28%29%20.%20%27?a=commitdiff_plain;h=bcfb9b86af0fefb59fa989e1aa16dee88f70211f;p=lhc%2Fweb%2Fwiklou.git mediawiki.page.gallery: Improve documentation This file does a lot of things, but the header starts with explaining a random/obscure thing it does with 4 lines of code at the end of this large file. Move that explanation near that actual code. Presumably it was placed at the top because it used to be the only thing the file was responsible for. Change-Id: I75299a25dd8f5f4d4ab4cdc8fc90d74e6a74422c --- diff --git a/resources/src/mediawiki.page.gallery.js b/resources/src/mediawiki.page.gallery.js index 79937e5706..9448ab8a78 100644 --- a/resources/src/mediawiki.page.gallery.js +++ b/resources/src/mediawiki.page.gallery.js @@ -1,6 +1,8 @@ /*! - * Show gallery captions when focused. Copied directly from jquery.mw-jump.js. - * Also Dynamically resize images to justify them. + * Enhance MediaWiki galleries (from the `` parser tag). + * + * - Toggle gallery captions when focused. + * - Dynamically resize images to fill horizontal space. */ ( function ( mw, $ ) { var $galleries, @@ -242,8 +244,9 @@ .addClass( 'mw-gallery-packed-overlay' ) .removeClass( 'mw-gallery-packed-hover' ); } else { - // Note use of just "a", not a.image, since we want this to trigger if a link in - // the caption receives focus + // Note use of just `a`, not `a.image`, since we also want this to trigger if a link + // within the caption text receives focus. + // This is based on code from the 'jquery.mw-jump' module. $content.find( 'ul.mw-gallery-packed-hover li.gallerybox' ).on( 'focus blur', 'a', function ( e ) { // Confusingly jQuery leaves e.type as focusout for delegated blur events var gettingFocus = e.type !== 'blur' && e.type !== 'focusout';