From a1516c6a14b813730ed2f48ba79185d49e54517a Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 2 Aug 2010 15:25:24 -0500 Subject: [PATCH] move getRealHeight so it can be more useful --- www/extras/admin/admin.js | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/www/extras/admin/admin.js b/www/extras/admin/admin.js index 910b51c1e..cfc3cf9ee 100644 --- a/www/extras/admin/admin.js +++ b/www/extras/admin/admin.js @@ -65,6 +65,43 @@ WebGUI.Admin = function(cfg){ }; +/** + * getRealHeight( elem ) + * Get the real height of the given element. + */ +WebGUI.Admin.getRealHeight += function ( elem ) { + var D = YAHOO.util.Dom; + var clipped = false; + // We don't want 0 height! + if ( parseInt( elem.style.height ) == 0 ) { + elem.style.display = "none"; + elem.style.height = "" + } + if (elem.style.display == 'none') { + clipped = true; + var _pos = D.getStyle(elem, 'position'); + var _vis = D.getStyle(elem, 'visiblity'); + D.setStyle(elem, 'position', 'absolute'); + D.setStyle(elem, 'visiblity', 'hidden'); + D.setStyle(elem, 'display', 'block'); + } + var height = elem.offsetHeight; + if (height == 'auto') { + //This is IE, let's fool it + D.setStyle(elem, 'zoom', '1'); + height = elem.clientHeight; + } + if (clipped) { + D.setStyle(elem, 'display', 'none'); + D.setStyle(elem, 'visiblity', _vis); + D.setStyle(elem, 'position', _pos); + } + //Strip the px from the style + return parseInt(height); + +}; + /** * afterShowTreeTab() * Fired after the Tree tab is shown. Refreshes if necessary. @@ -1304,7 +1341,7 @@ WebGUI.Admin.AdminBar } // Precalculate dtHeight and maxHeight - this.dtHeight = this.getRealHeight( this.dt[0] ) * this.dt.length; + this.dtHeight = WebGUI.Admin.getRealHeight( this.dt[0] ) * this.dt.length; this.maxHeight = YAHOO.util.Dom.getViewportHeight() - this.dtHeight; // Add custom event when showing an AdminBar pane @@ -1343,7 +1380,7 @@ WebGUI.Admin.AdminBar.prototype.getExpandHeight return this.maxHeight; } - var height = this.getRealHeight( elem ); + var height = WebGUI.Admin.getRealHeight( elem ); // Make sure not more than maxHeight if ( height > this.maxHeight ) { @@ -1352,43 +1389,6 @@ WebGUI.Admin.AdminBar.prototype.getExpandHeight return height; }; -/** - * getRealHeight( elem ) - * Get the real height of the given element. - */ -WebGUI.Admin.AdminBar.prototype.getRealHeight -= function ( elem ) { - var D = YAHOO.util.Dom; - var clipped = false; - // We don't want 0 height! - if ( parseInt( elem.style.height ) == 0 ) { - elem.style.display = "none"; - elem.style.height = "" - } - if (elem.style.display == 'none') { - clipped = true; - var _pos = D.getStyle(elem, 'position'); - var _vis = D.getStyle(elem, 'visiblity'); - D.setStyle(elem, 'position', 'absolute'); - D.setStyle(elem, 'visiblity', 'hidden'); - D.setStyle(elem, 'display', 'block'); - } - var height = elem.offsetHeight; - if (height == 'auto') { - //This is IE, let's fool it - D.setStyle(elem, 'zoom', '1'); - height = elem.clientHeight; - } - if (clipped) { - D.setStyle(elem, 'display', 'none'); - D.setStyle(elem, 'visiblity', _vis); - D.setStyle(elem, 'position', _pos); - } - //Strip the px from the style - return parseInt(height); - -}; - /** * show( id ) * Show the pane with the given ID. The ID is from the DT element.