/**
* @preserve
* jquery.layout 1.4.4
* $Date: 2014-11-29 08:00:00 (Sat, 29 November 2014) $
* $Rev: 1.0404 $
*
* Copyright (c) 2014 Kevin Dalman (http://jquery-dev.com)
* Based on work by Fabrizio Balliano (http://www.fabrizioballiano.net)
*
* Dual licensed under the GPL (http://www.gnu.org/licenses/gpl.html)
* and MIT (http://www.opensource.org/licenses/mit-license.php) licenses.
*
* SEE: http://layout.jquery-dev.com/LICENSE.txt
*
* Changelog: http://layout.jquery-dev.com/changelog.cfm
*
* Docs: http://layout.jquery-dev.com/documentation.html
* Tips: http://layout.jquery-dev.com/tips.html
* Help: http://groups.google.com/group/jquery-ui-layout
*/
//
东
//南
//西
//北
//中
//
/* JavaDoc Info: http://code.google.com/closure/compiler/docs/js-for-compiler.html
* {!Object} non-nullable type (never NULL)
* {?string} nullable type (sometimes NULL) - default for {Object}
* {number=} optional parameter
* {*} ALL types
*/
/* TODO for jQ 2.x
* check $.fn.disableSelection - this is in jQuery UI 1.9.x
*/
// NOTE: For best readability, view with a fixed-width font and tabs equal to 4-chars
;(function ($) {
// alias Math methods - used a lot!
var min = Math.min
, max = Math.max
, round = Math.floor
, isStr = function (v) { return $.type(v) === "string"; }
/**
* @param {!Object} Instance
* @param {Array.} a_fn
*/
, runPluginCallbacks = function (Instance, a_fn) {
if ($.isArray(a_fn))
for (var i=0, c=a_fn.length; i').appendTo("body")
, d = { width: $c.outerWidth - $c[0].clientWidth, height: 100 - $c[0].clientHeight };
$c.remove();
window.scrollbarWidth = d.width;
window.scrollbarHeight = d.height;
return dim.match(/^(width|height)$/) ? d[dim] : d;
}
, disableTextSelection: function () {
var $d = $(document)
, s = 'textSelectionDisabled'
, x = 'textSelectionInitialized'
;
if ($.fn.disableSelection) {
if (!$d.data(x)) // document hasn't been initialized yet
$d.on('mouseup', $.layout.enableTextSelection ).data(x, true);
if (!$d.data(s))
$d.disableSelection().data(s, true);
}
}
, enableTextSelection: function () {
var $d = $(document)
, s = 'textSelectionDisabled';
if ($.fn.enableSelection && $d.data(s))
$d.enableSelection().data(s, false);
}
/**
* Returns hash container 'display' and 'visibility'
*
* @see $.swap() - swaps CSS, runs callback, resets CSS
* @param {!Object} $E jQuery element
* @param {boolean=} [force=false] Run even if display != none
* @return {!Object} Returns current style props, if applicable
*/
, showInvisibly: function ($E, force) {
if ($E && $E.length && (force || $E.css("display") === "none")) { // only if not *already hidden*
var s = $E[0].style
// save ONLY the 'style' props because that is what we must restore
, CSS = { display: s.display || '', visibility: s.visibility || '' };
// show element 'invisibly' so can be measured
$E.css({ display: "block", visibility: "hidden" });
return CSS;
}
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, inset) {
var
// dimensions hash - start with current data IF passed
d = { css: {}, inset: {} }
, x = d.css // CSS hash
, i = { bottom: 0 } // TEMP insets (bottom = complier hack)
, N = $.layout.cssNum
, R = Math.round
, off = $E.offset()
, b, p, ei // TEMP border, padding
;
d.offsetLeft = off.left;
d.offsetTop = off.top;
if (!inset) inset = {}; // simplify logic below
$.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);
ei = e.toLowerCase();
d.inset[ei] = inset[ei] >= 0 ? inset[ei] : p; // any missing insetX value = paddingX
i[ei] = d.inset[ei] + b; // total offset of content from outer side
});
x.width = R($E.width());
x.height = R($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.outerWidth = R($E.outerWidth());
d.outerHeight = R($E.outerHeight());
// calc the TRUE inner-dimensions, even in quirks-mode!
d.innerWidth = max(0, d.outerWidth - i.left - i.right);
d.innerHeight = max(0, d.outerHeight - i.top - i.bottom);
// layoutWidth/Height is used in calcs for manual resizing
// layoutW/H only differs from innerW/H when in quirks-mode - then is like outerW/H
d.layoutWidth = R($E.innerWidth());
d.layoutHeight = R($E.innerHeight());
//if ($E.prop('tagName') === 'BODY') { debugData( d, $E.prop('tagName') ); } // DEBUG
//d.visible = $E.is(":visible");// && x.width > 0 && x.height > 0;
return d;
}
, getElementStyles: 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
}
/**
* Return the innerWidth for the current browser/doctype
*
* @see initPanes(), sizeMidPanes(), initHandles(), sizeHandles()
* @param {Array.