MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159204

Change subject: PictureShower: link directly to licensing information
......................................................................

PictureShower: link directly to licensing information

Requires I5bafde03c178fbdbf6937e010843fd1d01bac44e to ensure
that file pages are never collapsed.

Bug: 70151
Change-Id: Ibbdd7284fe26198ad330ce4a59c725b4ce9fb4ec
---
M javascripts/file/filepage.js
M javascripts/modules/mediaViewer/ImageOverlay.js
2 files changed, 18 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/04/159204/1

diff --git a/javascripts/file/filepage.js b/javascripts/file/filepage.js
index ea54b38..8cc0250 100644
--- a/javascripts/file/filepage.js
+++ b/javascripts/file/filepage.js
@@ -1,4 +1,4 @@
-( function() {
+( function( $, mw ) {
 
 function stopClickThrough() {
        var file = document.getElementById( 'file' ),
@@ -13,9 +13,20 @@
        }
 }
 
+function scrollToLicensingInformation() {
+       var $shared;
+
+       if ( window.location.hash !== '#mw-jump-to-license' ) {
+               return;
+       }
+       $shared = $( '#shared-image-desc' );
+       window.location.hash = $shared.length > 0 ? '#shared-image-desc' : 
'#mw-imagepage-content';
+}
+
 function init() {
        stopClickThrough();
+       scrollToLicensingInformation();
 }
 init();
 
-} )();
+} )( jQuery, mediaWiki );
diff --git a/javascripts/modules/mediaViewer/ImageOverlay.js 
b/javascripts/modules/mediaViewer/ImageOverlay.js
index f66b5ba..62287e0 100644
--- a/javascripts/modules/mediaViewer/ImageOverlay.js
+++ b/javascripts/modules/mediaViewer/ImageOverlay.js
@@ -25,7 +25,7 @@
                        this._super( options );
 
                        api.getThumb( options.title ).done( function( data ) {
-                               var author;
+                               var author, url = data.descriptionurl + 
'#mw-jump-to-license';
 
                                function removeLoader() {
                                        self.$( '.image-wrapper' ).removeClass( 
'loading' );
@@ -46,11 +46,13 @@
                                        $img.on( 'load', removeLoader );
                                }
                                self._positionImage();
-                               self.$( '.details a' ).attr( 'href', 
data.descriptionurl );
+                               self.$( '.details a' ).attr( 'href', url );
                                if ( data.extmetadata ) {
                                        // Add license information
                                        if ( data.extmetadata.LicenseShortName 
) {
-                                               self.$( '.license a' ).text( 
data.extmetadata.LicenseShortName.value );
+                                               self.$( '.license a' )
+                                                       .text( 
data.extmetadata.LicenseShortName.value )
+                                                       .attr( 'href', url );
                                        }
                                        // Add author information
                                        if ( data.extmetadata.Artist ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/159204
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbdd7284fe26198ad330ce4a59c725b4ce9fb4ec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to