Fix: Upgrade jquery layout library to fix a compatibility pb with jquery core 1.8.5

This commit is contained in:
Laurent Destailleur 2010-10-17 19:01:04 +00:00
parent c97a1c2e71
commit 69f266e518
5 changed files with 4102 additions and 8190 deletions

View File

@ -329,7 +329,7 @@ html, body {
, west__slidable: true , west__slidable: true
, west__resizable: true , west__resizable: true
, west__togglerLength_closed: '100%' , west__togglerLength_closed: '100%'
, useStateCookie: true /* Put this to false for dev */ , useStateCookie: true
}); });
jQuery('div.ui-layout-center').layout({ jQuery('div.ui-layout-center').layout({
@ -339,7 +339,6 @@ html, body {
, south__minSize: 32 , south__minSize: 32
, south__resizable: false , south__resizable: false
, south__closable: false , south__closable: false
, useStateCookie: true /* Put this to false for dev */
}); });
}); });
</SCRIPT>"; </SCRIPT>";

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/** /**
* @preserve jquery.layout 1.3.0 - Release Candidate 29.4 * @preserve jquery.layout 1.3.0 - Release Candidate 29.8
* $Date$ * $Date$
* $Rev: 30294 $ * $Rev: 30298 $
* *
* Copyright (c) 2010 * Copyright (c) 2010
* Fabrizio Balliano (http://www.fabrizioballiano.net) * Fabrizio Balliano (http://www.fabrizioballiano.net)
@ -1276,9 +1276,7 @@ $.fn.layout = function (opts) {
// initialize all layout elements // initialize all layout elements
initContainer(); // set CSS as needed and init state.container dimensions initContainer(); // set CSS as needed and init state.container dimensions
initPanes(); // size & position all panes - calls initHandles() initPanes(); // size & position panes - calls initHandles() - which calls initResizable()
//initHandles(); // create and position all resize bars & togglers buttons
initResizable(); // activate resizing on all panes where resizable=true
sizeContent(); // AFTER panes & handles have been initialized, size 'content' divs sizeContent(); // AFTER panes & handles have been initialized, size 'content' divs
if (o.scrollToBookmarkOnLoad) { if (o.scrollToBookmarkOnLoad) {
@ -1820,6 +1818,9 @@ $.fn.layout = function (opts) {
; ;
} }
// add Draggable events
initResizable(pane);
// ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open" // ADD CLASSNAMES & SLIDE-BINDINGS - eg: class="resizer resizer-west resizer-open"
if (s.isVisible) if (s.isVisible)
setAsOpen(pane); // onOpen will be called, but NOT onResize setAsOpen(pane); // onOpen will be called, but NOT onResize
@ -2335,16 +2336,16 @@ $.fn.layout = function (opts) {
// if this pane has a resizer bar, move it NOW - before animation // if this pane has a resizer bar, move it NOW - before animation
setAsClosed(pane); setAsClosed(pane);
// ANIMATE 'CLOSE' - if no animation, then was ALREADY shown above // CLOSE THE PANE
if (doFX) { if (doFX) { // animate the close
lockPaneForFX(pane, true); // need to set left/top so animation will work lockPaneForFX(pane, true); // need to set left/top so animation will work
$P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () { $P.hide( o.fxName_close, o.fxSettings_close, o.fxSpeed_close, function () {
lockPaneForFX(pane, false); // undo lockPaneForFX(pane, false); // undo
close_2(); close_2();
}); });
} }
else { else { // hide the pane without animation
$P.hide(); // hide pane NOW $P.hide();
close_2(); close_2();
}; };
@ -2363,7 +2364,7 @@ $.fn.layout = function (opts) {
if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) { if (!skipCallback && (state.initialized || o.triggerEventsOnLoad)) {
// onclose callback - UNLESS just 'showing' a hidden pane as 'closed' // onclose callback - UNLESS just 'showing' a hidden pane as 'closed'
if (!isShowing && !wasSliding) _execCallback(pane, o.onclose_end || o.onclose); if (!isShowing) _execCallback(pane, o.onclose_end || o.onclose);
// onhide OR onshow callback // onhide OR onshow callback
if (isShowing) _execCallback(pane, o.onshow_end || o.onshow); if (isShowing) _execCallback(pane, o.onshow_end || o.onshow);
if (isHiding) _execCallback(pane, o.onhide_end || o.onhide); if (isHiding) _execCallback(pane, o.onhide_end || o.onhide);
@ -2603,7 +2604,10 @@ $.fn.layout = function (opts) {
// onshow callback - TODO: should this be here? // onshow callback - TODO: should this be here?
if (s.isShowing) _execCallback(pane, o.onshow_end || o.onshow); if (s.isShowing) _execCallback(pane, o.onshow_end || o.onshow);
// ALSO call onresize because layout-size *may* have changed while pane was closed // ALSO call onresize because layout-size *may* have changed while pane was closed
if (state.initialized) _execCallback(pane, o.onresize_end || o.onresize); // if (state.initialized) if (state.initialized) {
_execCallback(pane, o.onresize_end || o.onresize);
resizeNestedLayout(pane);
}
} }
}; };
@ -2623,7 +2627,7 @@ $.fn.layout = function (opts) {
if (state[pane].isClosed) if (state[pane].isClosed)
open(pane, true); // true = slide - ie, called from here! open(pane, true); // true = slide - ie, called from here!
else // skip 'open' if already open! else // skip 'open' if already open! // TODO: does this use-case make sense???
bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane bindStopSlidingEvents(pane, true); // BIND trigger events to close sliding-pane
}; };
@ -2678,7 +2682,7 @@ $.fn.layout = function (opts) {
} }
else { // animation DONE - RESET CSS else { // animation DONE - RESET CSS
// TODO: see if this can be deleted. It causes a quick-close when sliding in Chrome // TODO: see if this can be deleted. It causes a quick-close when sliding in Chrome
//$P.css({ zIndex: (state[pane].isSliding ? _c.zIndex.pane_sliding : _c.zIndex.pane_normal) }); $P.css({ zIndex: (state[pane].isSliding ? _c.zIndex.pane_sliding : _c.zIndex.pane_normal) });
if (pane=="south") if (pane=="south")
$P.css({ top: "auto" }); $P.css({ top: "auto" });
else if (pane=="east") else if (pane=="east")
@ -2701,7 +2705,6 @@ $.fn.layout = function (opts) {
var bindStartSlidingEvent = function (pane, enable) { var bindStartSlidingEvent = function (pane, enable) {
var var
o = options[pane] o = options[pane]
, z = _c.zIndex
, $P = $Ps[pane] , $P = $Ps[pane]
, $R = $Rs[pane] , $R = $Rs[pane]
, trigger = o.slideTrigger_open , trigger = o.slideTrigger_open
@ -2714,10 +2717,6 @@ $.fn.layout = function (opts) {
else if (!trigger.match(/click|dblclick|mouseenter/)) else if (!trigger.match(/click|dblclick|mouseenter/))
trigger = o.slideTrigger_open = "click"; trigger = o.slideTrigger_open = "click";
// RE/SET zIndex - increases when pane is opening, resets to normal after close
$R.css("zIndex", !enable ? z.pane_sliding : z.resizer_normal);
$P.css("zIndex", !enable ? z.pane_sliding : z.pane_normal);
$R $R
// add or remove trigger event // add or remove trigger event
[enable ? "bind" : "unbind"](trigger +'.'+ sID, slideOpen) [enable ? "bind" : "unbind"](trigger +'.'+ sID, slideOpen)
@ -2740,6 +2739,7 @@ $.fn.layout = function (opts) {
var var
o = options[pane] o = options[pane]
, s = state[pane] , s = state[pane]
, z = _c.zIndex
, trigger = o.slideTrigger_close , trigger = o.slideTrigger_close
, action = (enable ? "bind" : "unbind") , action = (enable ? "bind" : "unbind")
, $P = $Ps[pane] , $P = $Ps[pane]
@ -2752,6 +2752,10 @@ $.fn.layout = function (opts) {
// ALSO will raise the zIndex of the pane & resizer // ALSO will raise the zIndex of the pane & resizer
if (enable) bindStartSlidingEvent(pane, false); if (enable) bindStartSlidingEvent(pane, false);
// RE/SET zIndex - increases when pane is sliding-open, resets to normal when not
$P.css("zIndex", enable ? z.pane_sliding : z.pane_normal);
$R.css("zIndex", enable ? z.pane_sliding : z.resizer_normal);
// make sure we have a valid event // make sure we have a valid event
if (!trigger.match(/click|mouseleave/)) if (!trigger.match(/click|mouseleave/))
trigger = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout' trigger = o.slideTrigger_close = "mouseleave"; // also catches 'mouseout'
@ -2941,9 +2945,7 @@ $.fn.layout = function (opts) {
if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) { if (!skipCallback && !skipResizeWhileDragging && state.initialized && s.isVisible) {
_execCallback(pane, o.onresize_end || o.onresize); _execCallback(pane, o.onresize_end || o.onresize);
// if Pane is the container for a nested layout, trigger resizeAll for that now resizeNestedLayout(pane);
if (o.resizeNestedLayout && $P.data("layoutContainer"))
$P.layout().resizeAll();
} }
// resize all the adjacent panes, and adjust their toggler buttons // resize all the adjacent panes, and adjust their toggler buttons
@ -3074,9 +3076,7 @@ $.fn.layout = function (opts) {
// resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized // resizeAll passes skipCallback because it triggers callbacks after ALL panes are resized
if (!skipCallback && state.initialized && s.isVisible) { if (!skipCallback && state.initialized && s.isVisible) {
_execCallback(pane, o.onresize_end || o.onresize); _execCallback(pane, o.onresize_end || o.onresize);
// if Pane is the container for a nested layout, trigger resizeAll for that now resizeNestedLayout(pane);
if (o.resizeNestedLayout && $P.data("layoutContainer"))
$P.layout().resizeAll();
} }
}); });
}; };
@ -3128,15 +3128,33 @@ $.fn.layout = function (opts) {
if (!$P) return; // SKIP if (!$P) return; // SKIP
if (state[pane].isVisible) // undefined for non-existent panes if (state[pane].isVisible) // undefined for non-existent panes
_execCallback(pane, o[pane].onresize_end || o[pane].onresize); // callback - if exists _execCallback(pane, o[pane].onresize_end || o[pane].onresize); // callback - if exists
// if Pane is the container for a nested layout, trigger resizeAll for that now resizeNestedLayout(pane);
if (o[pane].resizeNestedLayout && $P.data("layoutContainer"))
$P.layout().resizeAll();
}); });
_execCallback(null, o.onresizeall_end || o.onresizeall); // onresizeall callback, if exists _execCallback(null, o.onresizeall_end || o.onresizeall); // onresizeall callback, if exists
}; };
/**
* Whenever a pane resizes or opens that has a nested layout, trigger resizeAll
*
* @param {string} pane The pane just resized or opened
*/
var resizeNestedLayout = function (pane) {
var
$P = $Ps[pane]
, $C = $Cs[pane]
, d = "layoutContainer"
;
if (options[pane].resizeNestedLayout) {
if ($P.data( d ))
$P.layout().resizeAll();
else if ($C && $C.data( d ))
$C.layout().resizeAll();
}
};
/** /**
* IF pane has a content-div, then resize all elements inside pane to fit pane-height * IF pane has a content-div, then resize all elements inside pane to fit pane-height
* *
@ -3179,9 +3197,7 @@ $.fn.layout = function (opts) {
if (state.initialized) { if (state.initialized) {
_execCallback(pane, o.onsizecontent_end || o.onsizecontent); _execCallback(pane, o.onsizecontent_end || o.onsizecontent);
// if Content-DIV is the container for a nested layout, trigger resizeAll for that now resizeNestedLayout(pane);
if (o.resizeNestedLayout && $C.data("layoutContainer"))
$C.layout().resizeAll();
} }
@ -3468,7 +3484,6 @@ $.fn.layout = function (opts) {
// ALWAYS regenerate the resizer & toggler elements // ALWAYS regenerate the resizer & toggler elements
initHandles(pane); // create the required resizer & toggler initHandles(pane); // create the required resizer & toggler
initResizable(pane);
// if moving to different orientation, then keep 'target' pane size // if moving to different orientation, then keep 'target' pane size
if (c.dir != _c[oldPane].dir) { if (c.dir != _c[oldPane].dir) {