From 343e82cc8c62b0714f79139668a51ccef84aabd1 Mon Sep 17 00:00:00 2001 From: theopolisme Date: Wed, 18 Dec 2013 17:20:58 -0600 Subject: [PATCH] Include license in title attribute of link in FileUsageDialog The title attribute of the link that wraps the image in "Use this file on another website" will be set to the license and/or author of the image, if available. Bug: 56588 Change-Id: I5f504964ec3a63e4927385cb68e90856eb4cfe37 --- resources/ext.multimediaViewer/ext.multimediaViewer.js | 3 +++ .../ext.multimediaViewer.lightboxinterface.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/ext.multimediaViewer/ext.multimediaViewer.js b/resources/ext.multimediaViewer/ext.multimediaViewer.js index c0e5652c5..bf60aaab5 100755 --- a/resources/ext.multimediaViewer/ext.multimediaViewer.js +++ b/resources/ext.multimediaViewer/ext.multimediaViewer.js @@ -627,6 +627,9 @@ // Cannot display, fallback or fail license = 'default'; msgname = 'multimediaviewer-license-default'; + } else { + // License found, store the license data + ui.$license.data( 'license', mw.message( msgname ).text() ); } if ( license ) { diff --git a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js index 257c6d7e5..2d7daf739 100644 --- a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js +++ b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js @@ -327,6 +327,10 @@ pattern = /^\/[^\/]/, finalLink = pattern.test(link) ? linkPrefix +link: link, + license = this.$license.data( 'license' ) || '', + author = this.$author.text(), + linkTitle = ( license + ( author ? ' (' + author + ')' : '' ) ).trim(), + owtId = 'mw-mlb-use-file-onwiki-thumb', ownId = 'mw-mlb-use-file-onwiki-normal', owId = 'mw-mlb-use-file-offwiki', @@ -373,7 +377,7 @@ .prop( 'id', owId ) .prop( 'readonly', true ) .focus( selectAllOnEvent ) - .val( '' ), + .val( '' ), $offWiki = $( '
' )