User:Zzuuzz/scripts/blockreasons.js

// if ( 'Block' === mw.config.get( 'wgCanonicalSpecialPageName' ) ) {

$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function {

var reasons = [ 'abuse', 'compromised account', 'continued disruption', 'hate speech or heinous slurs', 'impersonation', 'long term abuse', 'repeated vandalism attempts', 'sockpuppetry', 'spammer', 'spamming', 'trolling or something', 'Undisclosed paid editing', 'vandalism', ': please choose another username (Username policy)', '' ];

var dropdown = new OO.ui.DropdownWidget( { label: 'Custom reasons' } ); dropdown.menu.addItems( reasons.map( function ( optionText ) { return new OO.ui.MenuOptionWidget( { label: optionText } ); } ) );

dropdown.menu.on( 'select', function( option ) {  $( '[name="wpReason-other"]' ).val( option.label ).trigger( 'change' );  } );

$( '#mw-htmlform-reason' ).before( dropdown.$element );

} );

} //