2 * Add autocomplete suggestions for names of registered users.
8 fetch: function ( userInput ) {
12 api = api || new mw.Api();
14 $.data( node, 'request', api.get( {
17 // Prefix of list=allusers is case sensitive. Normalise first
18 // character to uppercase so that "fo" may yield "Foo".
19 auprefix: userInput.charAt( 0 ).toUpperCase() + userInput.slice( 1 )
20 } ).done( function ( data ) {
21 var users = $.map( data.query.allusers, function ( userObj ) {
24 // Set the results as the autocomplete options
25 $textbox.suggestions( 'suggestions', users );
30 request = $.data( node, 'request' );
34 $.removeData( node, 'request' );
40 $( '.mw-autocomplete-user' ).suggestions( config );
42 }( mediaWiki, jQuery ) );