Snippets/Tick "Ignore any warnings" automatically

From mediawiki.org
How to use Snippets
List of Snippets
Tick "Ignore any warnings" automatically
Language(s): JavaScript
Compatible with: MediaWiki 1.20+ 

Description[edit]

Adding this snippet to MediaWiki:Common.js will tick the Ignore any warnings on Special:Upload automatically, if the user's browser has JavaScript enabled.

Code[edit]

/**
 * Tick "Ignore any warnings" on Special:Upload automatically
 *
 * @author Florian Schmidt
 * @date 2023-07-30
 * @source https://www.mediawiki.org/wiki/Snippets/Tick_%22Ignore_any_warnings%22_automatically
 */
jQuery( function( $ ) {
    if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
        $( '#wpIgnoreWarning' ).prop( 'checked', true );
    }
} );