Merge "Check minimum database server version when running update.php"
[lhc/web/wiklou.git] / resources / src / jquery / jquery.footHovzer.js
index 56fc32d..e601ddb 100644 (file)
@@ -1,17 +1,8 @@
 /**
- * Utility to stack stuff in an overlay fixed on the bottom of the page.
- *
- * Usage:
- * <code>
- *     var hovzer = $.getFootHovzer();
- *     hovzer.$.append( $myCollection );
- *     hovzer.update();
- * </code>
- *
- * @author Timo Tijhof, 2012
+ * @class jQuery.plugin.footHovzer
  */
 ( function ( $ ) {
-       var $hovzer, footHovzer, prevHeight, newHeight;
+       var $hovzer, footHovzer, $spacer;
 
        function getHovzer() {
                if ( $hovzer === undefined ) {
                return $hovzer;
        }
 
+       /**
+        * Utility to stack stuff in an overlay fixed on the bottom of the page.
+        *
+        * Usage:
+        *
+        *     var hovzer = $.getFootHovzer();
+        *     hovzer.$.append( $myCollection );
+        *     hovzer.update();
+        *
+        * @static
+        * @inheritable
+        * @return {jQuery.footHovzer}
+        */
+       $.getFootHovzer = function () {
+               footHovzer.$ = getHovzer();
+               return footHovzer;
+       };
+
+       /**
+        * @private
+        * @class jQuery.footHovzer
+        */
        footHovzer = {
+
+               /**
+                * @property {jQuery} $ The stack container
+                */
+
+               /**
+                * Update dimensions of stack to account for changes in the subtree.
+                */
                update: function () {
                        var $body;
 
                        $body = $( 'body' );
-                       if ( prevHeight === undefined ) {
-                               prevHeight = getHovzer().outerHeight( /*includeMargin=*/true );
-                               $body.css( 'paddingBottom', '+=' + prevHeight + 'px' );
-                       } else {
-                               newHeight = getHovzer().outerHeight( true );
-                               $body.css( 'paddingBottom', ( parseFloat( $body.css( 'paddingBottom' ) ) - prevHeight ) + newHeight );
-
-                               prevHeight = newHeight;
+
+                       if ( $spacer === undefined ) {
+                               $spacer = $( '<div>' ).attr( 'id', 'jquery-foot-hovzer-spacer' );
+                               $spacer.appendTo( $body );
                        }
+                       // Ensure CSS is applied by browser before using .outerHeight()
+                       setTimeout( function () {
+                               $spacer.css( 'height', getHovzer().outerHeight( /* includeMargin = */ true ) );
+                       }, 0 );
                }
        };
 
-       $.getFootHovzer = function () {
-               footHovzer.$ = getHovzer();
-               return footHovzer;
-       };
+       /**
+        * @class jQuery
+        * @mixins jQuery.plugin.footHovzer
+        */
 
 }( jQuery ) );