User:Zzuuzz/scripts/deletionreasons.js

if ( 'delete' === mw.config.get( 'wgAction' ) ) {

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

var reasons = [ 'CSD G1: Nonsense', 'CSD G2: Test pages', 'CSD G3: Disinformation', 'CSD G3: Spambot', 'CSD G3: Vandalism', 'CSD G4: Recreation of deleted material', 'CSD G5: Created by a Banned user', 'CSD G6: Housekeeping', 'CSD G7: Author requests deletion', 'CSD G8: Page dependent on a non-existent or deleted page', 'CSD G10: Unsourced negative biography', 'CSD G11: Advertising', 'CSD A1: Very short article providing little or no context', 'CSD A3: No meaningful content', 'CSD R1: Redirect to non-existent page', 'CSD R3: Implausible typo/misnomer', 'CSD U1: User requested deletion', 'CSD U2: No such user', 'CSD U5: Misuse of Wikipedia', 'Wikipedia is not a web host', 'Deleted under BLP and/or IAR policies' ];

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"]').val( option.label ).trigger( 'change' );  } );

$( '#wpReason' ).before( dropdown.$element );

} );

}