Open the download panel when an image is right clicked

Many users right-click on images as a way to download them.Due to this,
they may get a scaled-down version which is used for display purposes and
also not given guidance on how to attribute.

Bug: T75999
Change-Id: I30655a0dda4430b494a393f1fa708fce6ca6fafe
This commit is contained in:
Namit 2014-12-31 13:41:26 +05:30
parent 0788669bc7
commit d66509e2de
2 changed files with 7 additions and 1 deletions

View file

@ -214,9 +214,14 @@
} }
} ); } );
// open the download panel on right clicking the image
this.$image.on( 'mousedown.mmv-canvas', function ( e ) { this.$image.on( 'mousedown.mmv-canvas', function ( e ) {
if ( e.which === 3 ) { if ( e.which === 3 ) {
mw.mmv.actionLogger.log( 'right-click-image' ); mw.mmv.actionLogger.log( 'right-click-image' );
if ( !canvas.downloadOpen ) {
$( document ).trigger( 'mmv-download-open', e );
e.stopPropagation();
}
} }
} ); } );
}; };

View file

@ -132,7 +132,8 @@
// Don't close the dialog if the click inside a dialog or on an navigation arrow // Don't close the dialog if the click inside a dialog or on an navigation arrow
if ( $clickTarget.closest( dialog.$dialog ).length if ( $clickTarget.closest( dialog.$dialog ).length
|| $clickTarget.closest( '.mw-mmv-next-image' ).length || $clickTarget.closest( '.mw-mmv-next-image' ).length
|| $clickTarget.closest( '.mw-mmv-prev-image' ).length ) { || $clickTarget.closest( '.mw-mmv-prev-image' ).length
|| e.which === 3 ) {
return; return;
} }