build: Update eslint-config-wikimedia to 0.10.0
[lhc/web/wiklou.git] / resources / src / mediawiki.special.apisandbox / apisandbox.js
index 52bcd30..83a39d4 100644 (file)
@@ -33,7 +33,7 @@
                this.checkbox = new OO.ui.CheckboxInputWidget( config.checkbox )
                        .on( 'change', this.onCheckboxChange, [], this );
 
-               OptionalWidget[ 'super' ].call( this, config );
+               OptionalWidget.super.call( this, config );
 
                // Forward most methods for convenience
                for ( k in this.widget ) {
@@ -75,7 +75,7 @@
                }
        };
        OptionalWidget.prototype.setDisabled = function ( disabled ) {
-               OptionalWidget[ 'super' ].prototype.setDisabled.call( this, disabled );
+               OptionalWidget.super.prototype.setDisabled.call( this, disabled );
                this.widget.setDisabled( this.isDisabled() );
                this.checkbox.setSelected( !this.isDisabled() );
                this.$cover.toggle( this.isDisabled() );
@@ -90,7 +90,7 @@
                        },
                        setApiValue: function ( v ) {
                                if ( v === undefined ) {
-                                       v = this.paramInfo[ 'default' ];
+                                       v = this.paramInfo.default;
                                }
                                this.setValue( v );
                        },
                                var menu = this.getMenu();
 
                                if ( v === undefined ) {
-                                       v = this.paramInfo[ 'default' ];
+                                       v = this.paramInfo.default;
                                }
                                if ( v === undefined ) {
                                        menu.selectItem();
                                }
                        },
                        getApiValueForTemplates: function () {
-                               return this.isDisabled() ? this.parseApiValue( this.paramInfo[ 'default' ] ) : this.getValue();
+                               return this.isDisabled() ? this.parseApiValue( this.paramInfo.default ) : this.getValue();
                        },
                        getApiValue: function () {
                                var items = this.getValue();
                        },
                        setApiValue: function ( v ) {
                                if ( v === undefined ) {
-                                       v = this.paramInfo[ 'default' ];
+                                       v = this.paramInfo.default;
                                }
                                this.setValue( this.parseApiValue( v ) );
                        },
 
                submoduleWidget: {
                        single: function () {
-                               var v = this.isDisabled() ? this.paramInfo[ 'default' ] : this.getApiValue();
+                               var v = this.isDisabled() ? this.paramInfo.default : this.getApiValue();
                                return v === undefined ? [] : [ { value: v, path: this.paramInfo.submodules[ v ] } ];
                        },
                        multi: function () {
                                var map = this.paramInfo.submodules,
-                                       v = this.isDisabled() ? this.paramInfo[ 'default' ] : this.getApiValue();
+                                       v = this.isDisabled() ? this.paramInfo.default : this.getApiValue();
                                return v === undefined || v === '' ? [] : String( v ).split( '|' ).map( function ( v ) {
                                        return { value: v, path: map[ v ] };
                                } );
                                finalWidget.setDisabled( true );
                        }
 
-                       widget.setApiValue( pi[ 'default' ] );
+                       widget.setApiValue( pi.default );
 
                        return finalWidget;
                },
                        // OO.ui.ButtonWidget doesn't take focus itself (T128054)
                        $focus = $( '#mw-apisandbox-ui' ).find( document.activeElement );
                        if ( $focus.length ) {
+                               // eslint-disable-next-line jquery/no-event-shorthand
                                $focus[ 0 ].blur();
                        }
 
                                                                .text( data )
                                                                .appendTo( $result );
                                                }
-                                               if ( paramsAreForced || data[ 'continue' ] ) {
+                                               if ( paramsAreForced || data.continue ) {
                                                        $result.append(
                                                                $( '<div>' ).append(
                                                                        new OO.ui.ButtonWidget( {
                                                                                label: mw.message( 'apisandbox-continue' ).text()
                                                                        } ).on( 'click', function () {
-                                                                               ApiSandbox.sendRequest( $.extend( {}, baseRequestParams, data[ 'continue' ] ) );
-                                                                       } ).setDisabled( !data[ 'continue' ] ).$element,
+                                                                               ApiSandbox.sendRequest( $.extend( {}, baseRequestParams, data.continue ) );
+                                                                       } ).setDisabled( !data.continue ).$element,
                                                                        ( clear = new OO.ui.ButtonWidget( {
                                                                                label: mw.message( 'apisandbox-continue-clear' ).text()
                                                                        } ).on( 'click', function () {
                this.templatedItemsCache = {};
                this.tokenWidget = null;
                this.indentLevel = config.indentLevel ? config.indentLevel : 0;
-               ApiSandbox.PageLayout[ 'super' ].call( this, config.key, config );
+               ApiSandbox.PageLayout.super.call( this, config.key, config );
                this.loadParamInfo();
        };
        OO.inheritClass( ApiSandbox.PageLayout, OO.ui.PageLayout );
                // it makes it too hard to read and our "disabled"
                // isn't really disabled.
                widgetField.onFieldDisable( false );
-               widgetField.onFieldDisable = $.noop;
+               widgetField.onFieldDisable = function () {};
 
                widgetField.apiParamIndex = ppi.index;
 
                                widget = Util.createWidgetForParameter( {
                                        name: name,
                                        type: 'string',
-                                       'default': ''
+                                       default: ''
                                }, {
                                        nooptional: true
                                } );
                                        for ( i = 0; i < pi.parameters.length; i++ ) {
                                                if ( pi.parameters[ i ].name === 'action' ) {
                                                        pi.parameters[ i ].required = true;
-                                                       delete pi.parameters[ i ][ 'default' ];
+                                                       delete pi.parameters[ i ].default;
                                                }
                                                if ( pi.parameters[ i ].name === 'format' ) {
                                                        tmp = pi.parameters[ i ].type;
                                                                availableFormats[ tmp[ j ] ] = true;
                                                        }
                                                        pi.parameters[ i ].type = tmp.filter( filterFmModules );
-                                                       pi.parameters[ i ][ 'default' ] = 'json';
+                                                       pi.parameters[ i ].default = 'json';
                                                        pi.parameters[ i ].required = true;
                                                }
                                        }
                                }
 
                                that.deprecatedItemsFieldset = new OO.ui.FieldsetLayout().addItems( deprecatedItems ).toggle( false );
+                               // eslint-disable-next-line jquery/no-animate-toggle
                                tmp = $( '<fieldset>' )
                                        .toggle( !that.deprecatedItemsFieldset.isEmpty() )
                                        .append(