diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /resources/jquery/jquery.suggestions.js | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'resources/jquery/jquery.suggestions.js')
-rw-r--r-- | resources/jquery/jquery.suggestions.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/resources/jquery/jquery.suggestions.js b/resources/jquery/jquery.suggestions.js index 9fc8a47d..90cf53b2 100644 --- a/resources/jquery/jquery.suggestions.js +++ b/resources/jquery/jquery.suggestions.js @@ -66,20 +66,25 @@ $.suggestions = { }, /** * Ask the user-specified callback for new suggestions. Any previous delayed call to this function still pending - * will be canceled. If the value in the textbox hasn't changed since the last time suggestions were fetched, this + * will be canceled. If the value in the textbox is empty or hasn't changed since the last time suggestions were fetched, this * function does nothing. * @param {Boolean} delayed Whether or not to delay this by the currently configured amount of time */ update: function( context, delayed ) { - // Only fetch if the value in the textbox changed + // Only fetch if the value in the textbox changed and is not empty + // if the textbox is empty then clear the result div, but leave other settings intouched function maybeFetch() { - if ( context.data.$textbox.val() !== context.data.prevText ) { - context.data.prevText = context.data.$textbox.val(); + if ( context.data.$textbox.val().length == 0 ) { + context.data.$container.hide(); + context.data.prevText = ''; + } else if ( context.data.$textbox.val() !== context.data.prevText ) { if ( typeof context.config.fetch == 'function' ) { + context.data.prevText = context.data.$textbox.val(); context.config.fetch.call( context.data.$textbox, context.data.$textbox.val() ); } } } + // Cancel previous call if ( context.data.timerID != null ) { clearTimeout( context.data.timerID ); @@ -224,7 +229,7 @@ $.suggestions = { } else { result = selected.prev(); if ( selected.length == 0 ) { - // we are at the begginning, so lets jump to the last item + // we are at the beginning, so lets jump to the last item if ( context.data.$container.find( '.suggestions-special' ).html() != "" ) { result = context.data.$container.find( '.suggestions-special' ); } else { @@ -517,5 +522,4 @@ $.fn.suggestions = function() { } ); return returnValue !== null ? returnValue : $(this); }; - -} )( jQuery ); +} )( jQuery );
\ No newline at end of file |