From f80683b1d841b8fa81d6a283d597b36875fefd82 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Fri, 16 Nov 2012 18:52:30 +0200 Subject: [PATCH 1/2] Make clicking outside the ULS close the ULS Reported in Bugzilla: https://bugzilla.wikimedia.org/show_bug.cgi?id=41768 --- src/jquery.uls.core.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/jquery.uls.core.js b/src/jquery.uls.core.js index 9f13493..5cac4f4 100644 --- a/src/jquery.uls.core.js +++ b/src/jquery.uls.core.js @@ -206,14 +206,22 @@ */ listen: function() { var lcd, - uls = this; + uls = this, + cancelProxy = $.proxy( uls.cancel, uls ); // Register all event listeners to the ULS here. uls.$element.on( 'click', $.proxy( uls.click, 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 uls.$menu.on( 'keypress', $.proxy( this.keypress, this ) ) From c9a072934c44c75ebded8d5786d74b88ee79b7e8 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Fri, 16 Nov 2012 19:17:54 +0200 Subject: [PATCH 2/2] Make clicking the trigger show and hide the ULS Bugzilla: https://bugzilla.wikimedia.org/show_bug.cgi?id=41768 --- src/jquery.uls.core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jquery.uls.core.js b/src/jquery.uls.core.js index 5cac4f4..5f9ef31 100644 --- a/src/jquery.uls.core.js +++ b/src/jquery.uls.core.js @@ -319,7 +319,9 @@ click: function( e ) { e.stopPropagation(); e.preventDefault(); - if ( !this.shown ) { + if ( this.shown ) { + this.hide(); + } else { this.show(); } },