Replace deprecated `constructive` with `progressive`
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.apisandbox.js
index 3d90307..e58a6cf 100644 (file)
 
                capsuleWidget: {
                        getApiValue: function () {
-                               return this.getItemsData().join( '|' );
+                               var items = this.getItemsData();
+                               if ( items.join( '' ).indexOf( '|' ) === -1 ) {
+                                       return items.join( '|' );
+                               } else {
+                                       return '\x1f' + items.join( '\x1f' );
+                               }
                        },
                        setApiValue: function ( v ) {
-                               this.setItemsFromData( v === undefined || v === '' ? [] : String( v ).split( '|' ) );
+                               if ( v === undefined || v === '' || v === '\x1f' ) {
+                                       this.setItemsFromData( [] );
+                               } else {
+                                       v = String( v );
+                                       if ( v.indexOf( '\x1f' ) !== 0 ) {
+                                               this.setItemsFromData( v.split( '|' ) );
+                                       } else {
+                                               this.setItemsFromData( v.substr( 1 ).split( '\x1f' ) );
+                                       }
+                               }
                        },
                        apiCheckValid: function () {
                                var ok = this.getApiValue() !== undefined || suppressErrors;
                                        fullscreenButton.$element,
                                        new OO.ui.ButtonWidget( {
                                                label: mw.message( 'apisandbox-submit' ).text(),
-                                               flags: [ 'primary', 'constructive' ]
+                                               flags: [ 'primary', 'progressive' ]
                                        } ).on( 'click', ApiSandbox.sendRequest ).$element,
                                        new OO.ui.ButtonWidget( {
                                                label: mw.message( 'apisandbox-reset' ).text(),
                                                        dynamicParamNameWidget,
                                                        new OO.ui.ButtonWidget( {
                                                                icon: 'add',
-                                                               flags: 'constructive'
+                                                               flags: 'progressive'
                                                        } ).on( 'click', addDynamicParamWidget ),
                                                        {
                                                                label: mw.message( 'apisandbox-dynamic-parameters-add-label' ).text(),