Merge "Enable AuthManager by default"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.suggestions.js
index 719eacb..38e5a1f 100644 (file)
@@ -14,7 +14,7 @@
  *
  *             $( '#textbox' ).suggestions();
  *
- * Uses jQuery.suggestions singleteon internally.
+ * Uses jQuery.suggestions singleton internally.
  *
  * @class jQuery.plugin.suggestions
  */
                                                if ( +new Date() - cache[ val ].timestamp < context.config.cacheMaxAge ) {
                                                        context.data.$textbox.suggestions( 'suggestions', cache[ val ].suggestions );
                                                        if ( typeof context.config.update.after === 'function' ) {
-                                                               context.config.update.after.call( context.data.$textbox );
+                                                               context.config.update.after.call( context.data.$textbox, cache[ val ].metadata );
                                                        }
                                                        cacheHit = true;
                                                } else {
                                                context.config.fetch.call(
                                                        context.data.$textbox,
                                                        val,
-                                                       function ( suggestions ) {
+                                                       function ( suggestions, metadata ) {
                                                                suggestions = suggestions.slice( 0, context.config.maxRows );
                                                                context.data.$textbox.suggestions( 'suggestions', suggestions );
                                                                if ( typeof context.config.update.after === 'function' ) {
-                                                                       context.config.update.after.call( context.data.$textbox );
+                                                                       context.config.update.after.call( context.data.$textbox, metadata );
                                                                }
                                                                if ( context.config.cache ) {
                                                                        cache[ val ] = {
                                                                                suggestions: suggestions,
+                                                                               metadata: metadata,
                                                                                timestamp: +new Date()
                                                                        };
                                                                }
                                                                if ( $result.get( 0 ) !== $other.get( 0 ) ) {
                                                                        return;
                                                                }
-                                                               // Do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click).
+                                                               // Don't interfere with special clicks (e.g. to open in new tab)
                                                                if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
                                                                        $.suggestions.highlight( context, $result, true );
                                                                        if ( typeof context.config.result.select === 'function' ) {
                                                                if ( $special.get( 0 ) !== $other.get( 0 ) ) {
                                                                        return;
                                                                }
-                                                               // Do not interfere with non-left clicks or if modifier keys are pressed (e.g. ctrl-click).
+                                                               // Don't interfere with special clicks (e.g. to open in new tab)
                                                                if ( !( e.which !== 1 || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey ) ) {
                                                                        if ( typeof context.config.special.select === 'function' ) {
                                                                                context.config.special.select.call( $special, context.data.$textbox );