/**
* @preserve jquery.layout 1.3.0 - Release Candidate 29.15
* $Date: 2011-06-25 08:00:00 (Sat, 25 Jun 2011) $
* $Rev: 302915 $
*
* Copyright (c) 2010
* Fabrizio Balliano (http://www.fabrizioballiano.net)
* Kevin Dalman (http://allpro.net)
*
* Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
* and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
*
* Changelog: http://layout.jquery-dev.net/changelog.cfm#1.3.0.rc29.15
*
* Docs: http://layout.jquery-dev.net/documentation.html
* Tips: http://layout.jquery-dev.net/tips.html
* Help: http://groups.google.com/group/jquery-ui-layout
*/
// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars
;(function ($) {
/*
* GENERIC $.layout METHODS - used by all layouts
*/
$.layout = {
version: "1.3.rc29.15"
, revision: 0.032915 // 1.3.0 final = 1.0300 - major(n+).minor(nn)+patch(nn+)
// LANGUAGE CUSTOMIZATION
, language: {
// Tips and messages for resizers, togglers, custom buttons, etc.
Open: "Open" // eg: "Open Pane"
, Close: "Close"
, Resize: "Resize"
, Slide: "Slide Open"
, Pin: "Pin"
, Unpin: "Un-Pin"
, noRoomToOpenTip: "Not enough room to show this pane."
// Developer error messages
, pane: "pane" // description of "layout pane element"
, selector: "selector" // description of "jQuery-selector"
, errButton: "Error Adding Button \n\nInvalid "
, errContainerMissing: "UI Layout Initialization Error\n\nThe specified layout-container does not exist."
, errCenterPaneMissing: "UI Layout Initialization Error\n\nThe center-pane element does not exist.\n\nThe center-pane is a required element."
, errContainerHeight: "UI Layout Initialization Warning\n\nThe layout-container \"CONTAINER\" has no height.\n\nTherefore the layout is 0-height and hence 'invisible'!"
}
// can update code here if $.browser is phased out
, browser: {
mozilla: !!$.browser.mozilla
, webkit: !!$.browser.webkit || !!$.browser.safari // webkit = jQ 1.4
, msie: !!$.browser.msie
, isIE6: !!$.browser.msie && $.browser.version == 6
, boxModel: false // page must load first, so will be updated set by _create
//, version: $.browser.version - not used
}
/*
* GENERIC UTILITY METHODS
*/
// calculate and return the scrollbar width, as an integer
, scrollbarWidth: function () { return window.scrollbarWidth || $.layout.getScrollbarSize('width'); }
, scrollbarHeight: function () { return window.scrollbarHeight || $.layout.getScrollbarSize('height'); }
, getScrollbarSize: function (dim) {
var $c = $('
').appendTo("body");
var d = { width: $c.width() - $c[0].clientWidth, height: $c.height() - $c[0].clientHeight };
$c.remove();
window.scrollbarWidth = d.width;
window.scrollbarHeight = d.height;
return dim.match(/^(width|height)$/i) ? d[dim] : d;
}
/**
* Returns hash container 'display' and 'visibility'
*
* @see $.swap() - swaps CSS, runs callback, resets CSS
*/
, showInvisibly: function ($E, force) {
if (!$E) return {};
if (!$E.jquery) $E = $($E);
var CSS = {
display: $E.css('display')
, visibility: $E.css('visibility')
};
if (force || CSS.display == "none") { // only if not *already hidden*
$E.css({ display: "block", visibility: "hidden" }); // show element 'invisibly' so can be measured
return CSS;
}
else return {};
}
/**
* Returns data for setting size of an element (container or a pane).
*
* @see _create(), onWindowResize() for container, plus others for pane
* @return JSON Returns a hash of all dimensions: top, bottom, left, right, outerWidth, innerHeight, etc
*/
, getElementDimensions: function ($E) {
var
d = {} // dimensions hash
, x = d.css = {} // CSS hash
, i = {} // TEMP insets
, b, p // TEMP border, padding
, N = $.layout.cssNum
, off = $E.offset()
;
d.offsetLeft = off.left;
d.offsetTop = off.top;
$.each("Left,Right,Top,Bottom".split(","), function (idx, e) { // e = edge
b = x["border" + e] = $.layout.borderWidth($E, e);
p = x["padding"+ e] = $.layout.cssNum($E, "padding"+e);
i[e] = b + p; // total offset of content from outer side
d["inset"+ e] = p;
});
d.offsetWidth = $E.innerWidth();
d.offsetHeight = $E.innerHeight();
d.outerWidth = $E.outerWidth();
d.outerHeight = $E.outerHeight();
d.innerWidth = Math.max(0, d.outerWidth - i.Left - i.Right);
d.innerHeight = Math.max(0, d.outerHeight - i.Top - i.Bottom);
x.width = $E.width();
x.height = $E.height();
x.top = N($E,"top",true);
x.bottom = N($E,"bottom",true);
x.left = N($E,"left",true);
x.right = N($E,"right",true);
//d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0;
return d;
}
, getElementCSS: function ($E, list) {
var
CSS = {}
, style = $E[0].style
, props = list.split(",")
, sides = "Top,Bottom,Left,Right".split(",")
, attrs = "Color,Style,Width".split(",")
, p, s, a, i, j, k
;
for (i=0; i < props.length; i++) {
p = props[i];
if (p.match(/(border|padding|margin)$/))
for (j=0; j < 4; j++) {
s = sides[j];
if (p == "border")
for (k=0; k < 3; k++) {
a = attrs[k];
CSS[p+s+a] = style[p+s+a];
}
else
CSS[p+s] = style[p+s];
}
else
CSS[p] = style[p];
};
return CSS
}
/**
* Contains logic to check boxModel & browser, and return the correct width/height for the current browser/doctype
*
* @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
* @param {Array.