Use $.noop instead of function () {}
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.apisandbox.js
index ff6a80c..694f86a 100644 (file)
                                                if ( $.isFunction( f.focus ) ) {
                                                        f.focus();
                                                }
-                                       },
-                                       doNothing = function () {};
+                                       };
 
                                // This is something of a hack. We always want the 'format' and
                                // 'action' parameters from the main module to be specified,
                                                }
 
                                                descriptionContainer = $( '<div>' );
-                                               descriptionContainer.append( $( '<div>', {
-                                                       addClass: 'description',
-                                                       append: Util.parseHTML( pi.parameters[ i ].description )
-                                               } ) );
+
+                                               tmp = Util.parseHTML( pi.parameters[ i ].description );
+                                               tmp.filter( 'dl' ).makeCollapsible( {
+                                                       collapsed: true
+                                               } ).children( '.mw-collapsible-toggle' ).each( function () {
+                                                       var $this = $( this );
+                                                       $this.parent().prev( 'p' ).append( $this );
+                                               } );
+                                               descriptionContainer.append( $( '<div>', { addClass: 'description', append: tmp } ) );
+
                                                if ( pi.parameters[ i ].info && pi.parameters[ i ].info.length ) {
                                                        for ( j = 0; j < pi.parameters[ i ].info.length; j++ ) {
                                                                descriptionContainer.append( $( '<div>', {
                                                // it makes it too hard to read and our "disabled"
                                                // isn't really disabled.
                                                widgetField.onFieldDisable( false );
-                                               widgetField.onFieldDisable = doNothing;
+                                               widgetField.onFieldDisable = $.noop;
 
                                                if ( Util.apiBool( pi.parameters[ i ].deprecated ) ) {
                                                        deprecatedItems.push( widgetField, helpField );