From 97194de047dfac91dd9be571c74e7f59dec589eb Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Fri, 5 Oct 2012 08:38:43 +0200 Subject: [PATCH] Do nothing if the clicked region is already selected Supposed to fix bug https://bugzilla.wikimedia.org/show_bug.cgi?id=39932 --- src/jquery.uls.regionfilter.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/jquery.uls.regionfilter.js b/src/jquery.uls.regionfilter.js index e3e3c0c..6ffd721 100644 --- a/src/jquery.uls.regionfilter.js +++ b/src/jquery.uls.regionfilter.js @@ -125,21 +125,19 @@ }, click: function( e ) { + // Don't do anything if a region is selected already if( this.$element.hasClass( 'active' ) ) { - this.$element.removeClass( 'active' ); - if ( this.options.noresults ) { - this.options.noresults.call(); - } - } else { - // Re-populate the list of languages - this.options.$target.empty(); - this.show(); - // Make the selected region (and it only) active - $( '.regionselector' ).removeClass( 'active' ); - if ( this.regionGroup ) { - // if there is a region group, make it active. - this.$element.addClass( 'active' ); - } + return; + } + + // Re-populate the list of languages + this.options.$target.empty(); + this.show(); + // Make the selected region (and it only) active + $( '.regionselector' ).removeClass( 'active' ); + if ( this.regionGroup ) { + // if there is a region group, make it active. + this.$element.addClass( 'active' ); } } };