Merge "Add missing DROP SEQUENCE to postgres' tables.sql"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.htmlform.js
index de06859..0284e68 100644 (file)
@@ -1,42 +1,45 @@
 /**
  * Utility functions for jazzing up HTMLForm elements.
+ *
+ * @class jQuery.plugin.htmlform
  */
 ( function ( mw, $ ) {
 
        /**
         * jQuery plugin to fade or snap to visible state.
         *
-        * @param {boolean} instantToggle [optional]
+        * @param {boolean} [instantToggle=false]
         * @return {jQuery}
         */
        $.fn.goIn = function ( instantToggle ) {
                if ( instantToggle === true ) {
-                       return $(this).show();
+                       return $( this ).show();
                }
-               return $(this).stop( true, true ).fadeIn();
+               return $( this ).stop( true, true ).fadeIn();
        };
 
        /**
         * jQuery plugin to fade or snap to hiding state.
         *
-        * @param {boolean} instantToggle [optional]
+        * @param {boolean} [instantToggle=false]
         * @return jQuery
         */
        $.fn.goOut = function ( instantToggle ) {
                if ( instantToggle === true ) {
-                       return $(this).hide();
+                       return $( this ).hide();
                }
-               return $(this).stop( true, true ).fadeOut();
+               return $( this ).stop( true, true ).fadeOut();
        };
 
        /**
         * Bind a function to the jQuery object via live(), and also immediately trigger
         * the function on the objects with an 'instant' parameter set to true.
-        * @param {Function} callback Takes one parameter, which is {true} when the
-        *  event is called immediately, and {jQuery.Event} when triggered from an event.
+        * @param {Function} callback
+        * @param {boolean|jQuery.Event} callback.immediate True when the event is called immediately,
+        *  an event object when triggered from an event.
         */
-       $.fn.liveAndTestAtStart = function ( callback ){
-               $(this)
+       $.fn.liveAndTestAtStart = function ( callback ) {
+               $( this )
                        .live( 'change', callback )
                        .each( function () {
                                callback.call( this, true );
                // Animate the SelectOrOther fields, to only show the text field when
                // 'other' is selected.
                $( '.mw-htmlform-select-or-other' ).liveAndTestAtStart( function ( instant ) {
-                       var $other = $( '#' + $(this).attr( 'id' ) + '-other' );
+                       var $other = $( '#' + $( this ).attr( 'id' ) + '-other' );
                        $other = $other.add( $other.siblings( 'br' ) );
-                       if ( $(this).val() === 'other' ) {
+                       if ( $( this ).val() === 'other' ) {
                                $other.goIn( instant );
                        } else {
                                $other.goOut( instant );
                        }
-               });
+               } );
 
        } );
 
@@ -72,7 +75,7 @@
                        'class': 'htmlform-chzn-select mw-input ' + oldClass
                } );
                $oldContainer.find( 'input' ).each( function () {
-                       var $oldInput = $(this),
+                       var $oldInput = $( this ),
                        checked = $oldInput.prop( 'checked' ),
                        $option = $( '<option>' );
                        $option.prop( 'value', $oldInput.prop( 'value' ) );
                        } );
                }
        } );
+
+       /**
+        * @class jQuery
+        * @mixins jQuery.plugin.htmlform
+        */
 }( mediaWiki, jQuery ) );