build: Update eslint-config-wikimedia to 0.11.0
[lhc/web/wiklou.git] / resources / src / mediawiki.searchSuggest / searchSuggest.js
index bd94f29..df12b2e 100644 (file)
@@ -1,8 +1,8 @@
-/* eslint-disable no-restricted-properties */
 /*!
  * Add search suggestions to the search form.
  */
-( function ( mw, $ ) {
+( function () {
+       // eslint-disable-next-line no-jquery/no-map-util
        var searchNS = $.map( mw.config.get( 'wgFormattedNamespaces' ), function ( nsName, nsID ) {
                if ( nsID >= 0 && mw.user.options.get( 'searchNs' + nsID ) ) {
                        // Cast string key to number
@@ -22,6 +22,7 @@
                        } ).done( function ( data, jqXHR ) {
                                response( data[ 1 ], {
                                        type: jqXHR.getResponseHeader( 'X-OpenSearch-Type' ),
+                                       searchId: jqXHR.getResponseHeader( 'X-Search-ID' ),
                                        query: query
                                } );
                        } );
                                action: 'impression-results',
                                numberOfResults: context.config.suggestions.length,
                                resultSetType: metadata.type || 'unknown',
+                               searchId: metadata.searchId || null,
                                query: metadata.query,
                                inputLocation: getInputLocation( context )
                        } );
                        this.text( text );
 
                        // wrap only as link, if the config doesn't disallow it
-                       if ( textboxConfig.wrapAsLink !== false ) {
+                       if ( textboxConfig.wrapAsLink !== false ) {
                                this.wrap(
                                        $( '<a>' )
                                                .attr( 'href', formData.baseHref + $.param( formData.linkParams ) )
                                                } );
                                        } else {
                                                $input.closest( 'form' )
-                                                       .append( $( '<input type="hidden" name="fulltext" value="1"/>' ) );
+                                                       .append(
+                                                               $( '<input>' )
+                                                                       .prop( {
+                                                                               type: 'hidden',
+                                                                               value: 1
+                                                                       } )
+                                                                       .attr( 'name', 'fulltext' )
+                                                       );
                                        }
                                        return true; // allow the form to be submitted
                                }
                        .find( '.mw-fallbackSearchButton' ).remove();
        } );
 
-}( mediaWiki, jQuery ) );
+}() );