Merge "ext.echo.overlay: Unbreak removal logic"

This commit is contained in:
jenkins-bot 2013-11-10 02:46:46 +00:00 committed by Gerrit Code Review
commit 4b4e955ae7

View file

@ -21,6 +21,12 @@
configuration: mw.config.get( 'wgEchoOverlayConfiguration' ), configuration: mw.config.get( 'wgEchoOverlayConfiguration' ),
removeOverlay: function () {
$( '.mw-echo-overlay, .mw-echo-overlay-pokey' ).fadeOut( 'fast',
function () { $( this ).remove(); }
);
},
buildOverlay: function ( callback ) { buildOverlay: function ( callback ) {
var notificationLimit, var notificationLimit,
$overlay = $( '<div>' ).addClass( 'mw-echo-overlay' ), $overlay = $( '<div>' ).addClass( 'mw-echo-overlay' ),
@ -264,7 +270,7 @@
} }
$link.click( function ( e ) { $link.click( function ( e ) {
var $target, $overlay; var $target;
e.preventDefault(); e.preventDefault();
@ -272,20 +278,13 @@
mw.echo.logInteraction( 'ui-badge-link-click' ); mw.echo.logInteraction( 'ui-badge-link-click' );
$target = $( e.target ); $target = $( e.target );
// If the user clicked on the overlay or any child, // If the user clicked on the overlay or any child, ignore the click
// ignore the click if ( $target.hasClass( 'mw-echo-overlay' ) || $target.is( '.mw-echo-overlay *' ) ) {
if ( $target.hasClass( 'mw-echo-overlay' ) ||
$target.is( 'mw-echo-overlay *' )
) {
return; return;
} }
$overlay = $( '.mw-echo-overlay' ); if ( $( '.mw-echo-overlay' ).length ) {
mw.echo.overlay.removeOverlay();
if ( $overlay.length ) {
$overlay.fadeOut( 'fast',
function () { $overlay.remove(); }
);
return; return;
} }
@ -307,10 +306,8 @@
} ); } );
$( 'body' ).click( function ( e ) { $( 'body' ).click( function ( e ) {
if ( ! $( e.target ).is( '.mw-echo-overlay, .mw-echo-overlay *, .mw-echo-overlay-pokey' ) ) { if ( ! $( e.target ).is( '.mw-echo-overlay, .mw-echo-overlay *, .mw-echo-overlay-pokey, #pt-notifications a' ) ) {
$( '.mw-echo-overlay, .mw-echo-overlay-pokey' ).fadeOut( 'fast', mw.echo.overlay.removeOverlay();
function () { $( this ).remove(); }
);
} }
} ); } );
} ); } );