Merge "SpecialPageLanguage: Redirect to redirect by adding redirect=no"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.reasonSuggest.js
1 /*!
2 * Add autocomplete suggestions for action forms reasons.
3 */
4 ( function ( mw, $ ) {
5 $( function () {
6 var reasons = mw.config.get( 'reasons' );
7
8 // Add relevant suggestion
9 $( '#mwProtect-reason, #wpReason, #mw-input-wpReason-other' ).suggestions( {
10 fetch: function () {
11 var $this = $( this ), relevantSuggestions;
12 relevantSuggestions = $.grep( reasons, function ( reason ) {
13 return ( reason.toLowerCase().indexOf( $this.val().toLowerCase() ) > -1 );
14 } );
15 $this.suggestions( 'suggestions', relevantSuggestions );
16 },
17 highlightInput: true
18 } );
19 } );
20 }( mediaWiki, jQuery ) );