blob: 8157975560c281c754b1461adcea80fa616481f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/*
* HTMLForm enhancements:
* Set up autocomplete fields.
*/
( function ( mw, $ ) {
mw.hook( 'htmlform.enhance' ).add( function ( $root ) {
var $autocomplete = $root.find( '.mw-htmlform-autocomplete' );
if ( $autocomplete.length ) {
mw.loader.using( 'jquery.suggestions', function () {
$autocomplete.suggestions( {
fetch: function ( val ) {
var $el = $( this );
$el.suggestions( 'suggestions',
$.grep( $el.data( 'autocomplete' ), function ( v ) {
return v.indexOf( val ) === 0;
} )
);
}
} );
} );
}
} );
}( mediaWiki, jQuery ) );
|