blob: 18e417896ae84db17f0b5d51ba56b4dd4bdd417e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
/*
* HTMLForm enhancements:
* Set up autocomplete fields.
*/
mw.hook( 'htmlform.enhance' ).add( ( $root ) => {
const $autocomplete = $root.find( '.mw-htmlform-autocomplete' );
if ( $autocomplete.length ) {
mw.loader.using( 'jquery.suggestions', () => {
$autocomplete.suggestions( {
fetch: function ( val ) {
const $el = $( this );
$el.suggestions( 'suggestions',
$el.data( 'autocomplete' ).filter( ( v ) => v.indexOf( val ) === 0 )
);
}
} );
} );
}
} );
|