Don't show the overlay if the badge is not near the top of the window

Bug: 58728
Change-Id: Ia714425078c277d65af99389c95014d87e138e8c
This commit is contained in:
Bartosz Dziewoński 2013-12-21 14:24:47 +01:00
parent 3932d39a10
commit 3dc2b10b78

View file

@ -272,11 +272,17 @@
$link.click( function ( e ) {
var $target;
e.preventDefault();
// log the badge click
mw.echo.logInteraction( 'ui-badge-link-click' );
// If the link is not near the top of the window, showing the overlay below it
// will likely look very silly, so let's not do this and just go the special page
if ( $link.offset().top > 0.2 * $( window ).height() ) {
return;
}
e.preventDefault();
$target = $( e.target );
// If the user clicked on the overlay or any child, ignore the click
if ( $target.hasClass( 'mw-echo-overlay' ) || $target.is( '.mw-echo-overlay *' ) ) {