Merge pull request #39 from amire80/bug_41768

Clicking outside ULS popup should close the popup
This commit is contained in:
Niklas Laxström
2012-11-16 09:49:01 -08:00

View File

@@ -206,14 +206,22 @@
*/ */
listen: function() { listen: function() {
var lcd, var lcd,
uls = this; uls = this,
cancelProxy = $.proxy( uls.cancel, uls );
// Register all event listeners to the ULS here. // Register all event listeners to the ULS here.
uls.$element.on( 'click', $.proxy( uls.click, uls ) ); uls.$element.on( 'click', $.proxy( uls.click, uls ) );
uls.$languageFilter.on( 'searchclear', $.proxy( uls.defaultSearch, uls ) ); uls.$languageFilter.on( 'searchclear', $.proxy( uls.defaultSearch, uls ) );
// Handle click on close button
uls.$menu.find( '#uls-close' ).on( 'click', $.proxy( uls.cancel, uls ) ); // Close when clicking on the close button
uls.$menu.find( '#uls-close' ).on( 'click', cancelProxy );
// Don't do anything if pressing on empty space in the ULS
uls.$menu.on( 'click', function ( e ) {
e.stopPropagation();
} );
// Close ULS if clicking elsewhere
$( document ).on( 'click', cancelProxy );
// Handle key press events on the menu // Handle key press events on the menu
uls.$menu.on( 'keypress', $.proxy( this.keypress, this ) ) uls.$menu.on( 'keypress', $.proxy( this.keypress, this ) )
@@ -311,7 +319,9 @@
click: function( e ) { click: function( e ) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
if ( !this.shown ) { if ( this.shown ) {
this.hide();
} else {
this.show(); this.show();
} }
}, },