2014-10-07 17:28:24 +02:00
/ * !
2015-03-11 16:12:27 +01:00
* jQuery UI Draggable 1.11 . 4
2014-10-07 17:28:24 +02:00
* http : //jqueryui.com
*
2015-02-27 11:21:26 +01:00
* Copyright jQuery Foundation and other contributors
2014-10-07 17:28:24 +02:00
* Released under the MIT license .
* http : //jquery.org/license
*
* http : //api.jqueryui.com/draggable/
* /
2015-11-05 18:47:30 +01:00
! function ( a ) { "function" == typeof define && define . amd ?
// AMD. Register as an anonymous module.
define ( [ "jquery" , "./core" , "./mouse" , "./widget" ] , a ) :
// Browser globals
a ( jQuery ) } ( function ( a ) { return a . widget ( "ui.draggable" , a . ui . mouse , { version : "1.11.4" , widgetEventPrefix : "drag" , options : { addClasses : ! 0 , appendTo : "parent" , axis : ! 1 , connectToSortable : ! 1 , containment : ! 1 , cursor : "auto" , cursorAt : ! 1 , grid : ! 1 , handle : ! 1 , helper : "original" , iframeFix : ! 1 , opacity : ! 1 , refreshPositions : ! 1 , revert : ! 1 , revertDuration : 500 , scope : "default" , scroll : ! 0 , scrollSensitivity : 20 , scrollSpeed : 20 , snap : ! 1 , snapMode : "both" , snapTolerance : 20 , stack : ! 1 , zIndex : ! 1 ,
// callbacks
drag : null , start : null , stop : null } , _create : function ( ) { "original" === this . options . helper && this . _setPositionRelative ( ) , this . options . addClasses && this . element . addClass ( "ui-draggable" ) , this . options . disabled && this . element . addClass ( "ui-draggable-disabled" ) , this . _setHandleClassName ( ) , this . _mouseInit ( ) } , _setOption : function ( a , b ) { this . _super ( a , b ) , "handle" === a && ( this . _removeHandleClassName ( ) , this . _setHandleClassName ( ) ) } , _destroy : function ( ) { return ( this . helper || this . element ) . is ( ".ui-draggable-dragging" ) ? void ( this . destroyOnClear = ! 0 ) : ( this . element . removeClass ( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ) , this . _removeHandleClassName ( ) , void this . _mouseDestroy ( ) ) } , _mouseCapture : function ( b ) { var c = this . options ;
// among others, prevent a drag on a resizable-handle
// among others, prevent a drag on a resizable-handle
//Quit if we're not on a valid handle
return this . _blurActiveElement ( b ) , this . helper || c . disabled || a ( b . target ) . closest ( ".ui-resizable-handle" ) . length > 0 ? ! 1 : ( this . handle = this . _getHandle ( b ) , this . handle ? ( this . _blockFrames ( c . iframeFix === ! 0 ? "iframe" : c . iframeFix ) , ! 0 ) : ! 1 ) } , _blockFrames : function ( b ) { this . iframeBlocks = this . document . find ( b ) . map ( function ( ) { var b = a ( this ) ; return a ( "<div>" ) . css ( "position" , "absolute" ) . appendTo ( b . parent ( ) ) . outerWidth ( b . outerWidth ( ) ) . outerHeight ( b . outerHeight ( ) ) . offset ( b . offset ( ) ) [ 0 ] } ) } , _unblockFrames : function ( ) { this . iframeBlocks && ( this . iframeBlocks . remove ( ) , delete this . iframeBlocks ) } , _blurActiveElement : function ( b ) { var c = this . document [ 0 ] ;
// Only need to blur if the event occurred on the draggable itself, see #10527
if ( this . handleElement . is ( b . target ) )
// support: IE9
// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
try {
// Support: IE9, IE10
// If the <body> is blurred, IE will switch windows, see #9520
c . activeElement && "body" !== c . activeElement . nodeName . toLowerCase ( ) &&
// Blur any element that currently has focus, see #4261
a ( c . activeElement ) . blur ( ) } catch ( d ) { } } , _mouseStart : function ( b ) { var c = this . options ;
//Trigger event + callbacks
//Create and append the visible helper
//Cache the helper size
//If ddmanager is used for droppables, set the global draggable
/ *
* - Position generation -
* This block generates everything position related - it ' s the core of draggables .
* /
//Cache the margins of the original element
//Store the helper's css position
//The element's absolute position on the page minus margins
//Generate the original position
//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
//Set a containment if given in the options
//Trigger event + callbacks
//Recache the helper size
//Prepare the droppable offsets
// Reset helper's right/bottom css if they're set and set explicit width/height instead
// as this prevents resizing of elements with right/bottom set (see #7772)
//Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
return this . helper = this . _createHelper ( b ) , this . helper . addClass ( "ui-draggable-dragging" ) , this . _cacheHelperProportions ( ) , a . ui . ddmanager && ( a . ui . ddmanager . current = this ) , this . _cacheMargins ( ) , this . cssPosition = this . helper . css ( "position" ) , this . scrollParent = this . helper . scrollParent ( ! 0 ) , this . offsetParent = this . helper . offsetParent ( ) , this . hasFixedAncestor = this . helper . parents ( ) . filter ( function ( ) { return "fixed" === a ( this ) . css ( "position" ) } ) . length > 0 , this . positionAbs = this . element . offset ( ) , this . _refreshOffsets ( b ) , this . originalPosition = this . position = this . _generatePosition ( b , ! 1 ) , this . originalPageX = b . pageX , this . originalPageY = b . pageY , c . cursorAt && this . _adjustOffsetFromHelper ( c . cursorAt ) , this . _setContainment ( ) , this . _trigger ( "start" , b ) === ! 1 ? ( this . _clear ( ) , ! 1 ) : ( this . _cacheHelperProportions ( ) , a . ui . ddmanager && ! c . dropBehaviour && a . ui . ddmanager . prepareOffsets ( this , b ) , this . _normalizeRightBottom ( ) , this . _mouseDrag ( b , ! 0 ) , a . ui . ddmanager && a . ui . ddmanager . dragStart ( this , b ) , ! 0 ) } , _refreshOffsets : function ( a ) { this . offset = { top : this . positionAbs . top - this . margins . top , left : this . positionAbs . left - this . margins . left , scroll : ! 1 , parent : this . _getParentOffset ( ) , relative : this . _getRelativeOffset ( ) } , this . offset . click = { left : a . pageX - this . offset . left , top : a . pageY - this . offset . top } } , _mouseDrag : function ( b , c ) {
//Call plugins and callbacks and use the resulting position if something is returned
if (
// reset any necessary cached properties (see #5009)
this . hasFixedAncestor && ( this . offset . parent = this . _getParentOffset ( ) ) ,
//Compute the helpers position
this . position = this . _generatePosition ( b , ! 0 ) , this . positionAbs = this . _convertPositionTo ( "absolute" ) , ! c ) { var d = this . _uiHash ( ) ; if ( this . _trigger ( "drag" , b , d ) === ! 1 ) return this . _mouseUp ( { } ) , ! 1 ; this . position = d . position } return this . helper [ 0 ] . style . left = this . position . left + "px" , this . helper [ 0 ] . style . top = this . position . top + "px" , a . ui . ddmanager && a . ui . ddmanager . drag ( this , b ) , ! 1 } , _mouseStop : function ( b ) {
//If we are using droppables, inform the manager about the drop
var c = this , d = ! 1 ;
//if a drop comes from outside (a sortable)
return a . ui . ddmanager && ! this . options . dropBehaviour && ( d = a . ui . ddmanager . drop ( this , b ) ) , this . dropped && ( d = this . dropped , this . dropped = ! 1 ) , "invalid" === this . options . revert && ! d || "valid" === this . options . revert && d || this . options . revert === ! 0 || a . isFunction ( this . options . revert ) && this . options . revert . call ( this . element , d ) ? a ( this . helper ) . animate ( this . originalPosition , parseInt ( this . options . revertDuration , 10 ) , function ( ) { c . _trigger ( "stop" , b ) !== ! 1 && c . _clear ( ) } ) : this . _trigger ( "stop" , b ) !== ! 1 && this . _clear ( ) , ! 1 } , _mouseUp : function ( b ) {
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
// Only need to focus if the event occurred on the draggable itself, see #10527
// The interaction is over; whether or not the click resulted in a drag, focus the element
return this . _unblockFrames ( ) , a . ui . ddmanager && a . ui . ddmanager . dragStop ( this , b ) , this . handleElement . is ( b . target ) && this . element . focus ( ) , a . ui . mouse . prototype . _mouseUp . call ( this , b ) } , cancel : function ( ) { return this . helper . is ( ".ui-draggable-dragging" ) ? this . _mouseUp ( { } ) : this . _clear ( ) , this } , _getHandle : function ( b ) { return this . options . handle ? ! ! a ( b . target ) . closest ( this . element . find ( this . options . handle ) ) . length : ! 0 } , _setHandleClassName : function ( ) { this . handleElement = this . options . handle ? this . element . find ( this . options . handle ) : this . element , this . handleElement . addClass ( "ui-draggable-handle" ) } , _removeHandleClassName : function ( ) { this . handleElement . removeClass ( "ui-draggable-handle" ) } , _createHelper : function ( b ) { var c = this . options , d = a . isFunction ( c . helper ) , e = d ? a ( c . helper . apply ( this . element [ 0 ] , [ b ] ) ) : "clone" === c . helper ? this . element . clone ( ) . removeAttr ( "id" ) : this . element ;
// http://bugs.jqueryui.com/ticket/9446
// a helper function can return the original element
// which wouldn't have been set to relative in _create
return e . parents ( "body" ) . length || e . appendTo ( "parent" === c . appendTo ? this . element [ 0 ] . parentNode : c . appendTo ) , d && e [ 0 ] === this . element [ 0 ] && this . _setPositionRelative ( ) , e [ 0 ] === this . element [ 0 ] || /(fixed|absolute)/ . test ( e . css ( "position" ) ) || e . css ( "position" , "absolute" ) , e } , _setPositionRelative : function ( ) { /^(?:r|a|f)/ . test ( this . element . css ( "position" ) ) || ( this . element [ 0 ] . style . position = "relative" ) } , _adjustOffsetFromHelper : function ( b ) { "string" == typeof b && ( b = b . split ( " " ) ) , a . isArray ( b ) && ( b = { left : + b [ 0 ] , top : + b [ 1 ] || 0 } ) , "left" in b && ( this . offset . click . left = b . left + this . margins . left ) , "right" in b && ( this . offset . click . left = this . helperProportions . width - b . right + this . margins . left ) , "top" in b && ( this . offset . click . top = b . top + this . margins . top ) , "bottom" in b && ( this . offset . click . top = this . helperProportions . height - b . bottom + this . margins . top ) } , _isRootNode : function ( a ) { return /(html|body)/i . test ( a . tagName ) || a === this . document [ 0 ] } , _getParentOffset : function ( ) {
//Get the offsetParent and cache its position
var b = this . offsetParent . offset ( ) , c = this . document [ 0 ] ;
// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
return "absolute" === this . cssPosition && this . scrollParent [ 0 ] !== c && a . contains ( this . scrollParent [ 0 ] , this . offsetParent [ 0 ] ) && ( b . left += this . scrollParent . scrollLeft ( ) , b . top += this . scrollParent . scrollTop ( ) ) , this . _isRootNode ( this . offsetParent [ 0 ] ) && ( b = { top : 0 , left : 0 } ) , { top : b . top + ( parseInt ( this . offsetParent . css ( "borderTopWidth" ) , 10 ) || 0 ) , left : b . left + ( parseInt ( this . offsetParent . css ( "borderLeftWidth" ) , 10 ) || 0 ) } } , _getRelativeOffset : function ( ) { if ( "relative" !== this . cssPosition ) return { top : 0 , left : 0 } ; var a = this . element . position ( ) , b = this . _isRootNode ( this . scrollParent [ 0 ] ) ; return { top : a . top - ( parseInt ( this . helper . css ( "top" ) , 10 ) || 0 ) + ( b ? 0 : this . scrollParent . scrollTop ( ) ) , left : a . left - ( parseInt ( this . helper . css ( "left" ) , 10 ) || 0 ) + ( b ? 0 : this . scrollParent . scrollLeft ( ) ) } } , _cacheMargins : function ( ) { this . margins = { left : parseInt ( this . element . css ( "marginLeft" ) , 10 ) || 0 , top : parseInt ( this . element . css ( "marginTop" ) , 10 ) || 0 , right : parseInt ( this . element . css ( "marginRight" ) , 10 ) || 0 , bottom : parseInt ( this . element . css ( "marginBottom" ) , 10 ) || 0 } } , _cacheHelperProportions : function ( ) { this . helperProportions = { width : this . helper . outerWidth ( ) , height : this . helper . outerHeight ( ) } } , _setContainment : function ( ) { var b , c , d , e = this . options , f = this . document [ 0 ] ; return this . relativeContainer = null , e . containment ? "window" === e . containment ? void ( this . containment = [ a ( window ) . scrollLeft ( ) - this . offset . relative . left - this . offset . parent . left , a ( window ) . scrollTop ( ) - this . offset . relative . top - this . offset . parent . top , a ( window ) . scrollLeft ( ) + a ( window ) . width ( ) - this . helperProportions . width - this . margins . left , a ( window ) . scrollTop ( ) + ( a ( window ) . height ( ) || f . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ) : "document" === e . containment ? void ( this . containment = [ 0 , 0 , a ( f ) . width ( ) - this . helperProportions . width - this . margins . left , ( a ( f ) . height ( ) || f . body . parentNode . scrollHeight ) - this . helperProportions . height - this . margins . top ] ) : e . containment . constructor === Array ? void ( this . containment = e . containment ) : ( "parent" === e . containment && ( e . containment = this . helper [ 0 ] . parentNode ) , c = a ( e . containment ) , d = c [ 0 ] , void ( d && ( b = /(scroll|auto)/ . test ( c . css ( "overflow" ) ) , this . containment = [ ( parseInt ( c . css ( "borderLeftWidth" ) , 10 ) || 0 ) + ( parseInt ( c . css ( "paddingLeft" ) , 10 ) || 0 ) , ( parseInt ( c . css ( "borderTopWidth" ) , 10 ) || 0 ) + ( parseInt ( c . css ( "paddingTop" ) , 10 ) || 0 ) , ( b ? Math . max ( d . scrollWidth , d . offsetWidth ) : d . offsetWidth ) - ( parseInt ( c . css ( "borderRightWidth" ) , 10 ) || 0 ) - ( parseInt ( c . css ( "paddingRight" ) , 10 ) || 0 ) - this . helperProportions . width - this . margins . left - this . margins . right , ( b ? Math . max ( d . scrollHeight , d . offsetHeight ) : d . offsetHeight ) - ( parseInt ( c . css ( "borderBottomWidth" ) , 10 ) || 0 ) - ( parseInt ( c . css ( "paddingBottom" ) , 10 ) || 0 ) - this . helperProportions . height - this . margins . top - this . margins . bottom ] , this . relativeContainer = c ) ) ) : void ( this . containment = null ) } , _convertPositionTo : function ( a , b ) { b || ( b = this . position ) ; var c = "absolute" === a ? 1 : - 1 , d = this . _isRootNode ( this . scrollParent [ 0 ] ) ; return { top : b . top + // The absolute mouse position
this . offset . relative . top * c + // Only for relative positioned nodes: Relative offset from element to offset parent
this . offset . parent . top * c - // The offsetParent's offset without borders (offset + border)
( "fixed" === this . cssPosition ? - this . offset . scroll . top : d ? 0 : this . offset . scroll . top ) * c , left : b . left + // The absolute mouse position
this . offset . relative . left * c + // Only for relative positioned nodes: Relative offset from element to offset parent
this . offset . parent . left * c - // The offsetParent's offset without borders (offset + border)
( "fixed" === this . cssPosition ? - this . offset . scroll . left : d ? 0 : this . offset . scroll . left ) * c } } , _generatePosition : function ( a , b ) { var c , d , e , f , g = this . options , h = this . _isRootNode ( this . scrollParent [ 0 ] ) , i = a . pageX , j = a . pageY ;
// Cache the scroll
/ *
* - Position constraining -
* Constrain the position to a mix of grid , containment .
* /
// If we are not dragging yet, we won't check for options
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
return h && this . offset . scroll || ( this . offset . scroll = { top : this . scrollParent . scrollTop ( ) , left : this . scrollParent . scrollLeft ( ) } ) , b && ( this . containment && ( this . relativeContainer ? ( d = this . relativeContainer . offset ( ) , c = [ this . containment [ 0 ] + d . left , this . containment [ 1 ] + d . top , this . containment [ 2 ] + d . left , this . containment [ 3 ] + d . top ] ) : c = this . containment , a . pageX - this . offset . click . left < c [ 0 ] && ( i = c [ 0 ] + this . offset . click . left ) , a . pageY - this . offset . click . top < c [ 1 ] && ( j = c [ 1 ] + this . offset . click . top ) , a . pageX - this . offset . click . left > c [ 2 ] && ( i = c [ 2 ] + this . offset . click . left ) , a . pageY - this . offset . click . top > c [ 3 ] && ( j = c [ 3 ] + this . offset . click . top ) ) , g . grid && ( e = g . grid [ 1 ] ? this . originalPageY + Math . round ( ( j - this . originalPageY ) / g . grid [ 1 ] ) * g . grid [ 1 ] : this . originalPageY , j = c ? e - this . offset . click . top >= c [ 1 ] || e - this . offset . click . top > c [ 3 ] ? e : e - this . offset . click . top >= c [ 1 ] ? e - g . grid [ 1 ] : e + g . grid [ 1 ] : e , f = g . grid [ 0 ] ? this . originalPageX + Math . round ( ( i - this . originalPageX ) / g . grid [ 0 ] ) * g . grid [ 0 ] : this . originalPageX , i = c ? f - this . offset . click . left >= c [ 0 ] || f - this . offset . click . left > c [ 2 ] ? f : f - this . offset . click . left >= c [ 0 ] ? f - g . grid [ 0 ] : f + g . grid [ 0 ] : f ) , "y" === g . axis && ( i = this . originalPageX ) , "x" === g . axis && ( j = this . originalPageY ) ) , { top : j - // The absolute mouse position
this . offset . click . top - // Click offset (relative to the element)
this . offset . relative . top - // Only for relative positioned nodes: Relative offset from element to offset parent
this . offset . parent . top + ( // The offsetParent's offset without borders (offset + border)
"fixed" === this . cssPosition ? - this . offset . scroll . top : h ? 0 : this . offset . scroll . top ) , left : i - // The absolute mouse position
this . offset . click . left - // Click offset (relative to the element)
this . offset . relative . left - // Only for relative positioned nodes: Relative offset from element to offset parent
this . offset . parent . left + ( // The offsetParent's offset without borders (offset + border)
"fixed" === this . cssPosition ? - this . offset . scroll . left : h ? 0 : this . offset . scroll . left ) } } , _clear : function ( ) { this . helper . removeClass ( "ui-draggable-dragging" ) , this . helper [ 0 ] === this . element [ 0 ] || this . cancelHelperRemoval || this . helper . remove ( ) , this . helper = null , this . cancelHelperRemoval = ! 1 , this . destroyOnClear && this . destroy ( ) } , _normalizeRightBottom : function ( ) { "y" !== this . options . axis && "auto" !== this . helper . css ( "right" ) && ( this . helper . width ( this . helper . width ( ) ) , this . helper . css ( "right" , "auto" ) ) , "x" !== this . options . axis && "auto" !== this . helper . css ( "bottom" ) && ( this . helper . height ( this . helper . height ( ) ) , this . helper . css ( "bottom" , "auto" ) ) } ,
// From now on bulk stuff - mainly helpers
_trigger : function ( b , c , d ) {
// Absolute position and offset (see #6884 ) have to be recalculated after plugins
return d = d || this . _uiHash ( ) , a . ui . plugin . call ( this , b , [ c , d , this ] , ! 0 ) , /^(drag|start|stop)/ . test ( b ) && ( this . positionAbs = this . _convertPositionTo ( "absolute" ) , d . offset = this . positionAbs ) , a . Widget . prototype . _trigger . call ( this , b , c , d ) } , plugins : { } , _uiHash : function ( ) { return { helper : this . helper , position : this . position , originalPosition : this . originalPosition , offset : this . positionAbs } } } ) , a . ui . plugin . add ( "draggable" , "connectToSortable" , { start : function ( b , c , d ) { var e = a . extend ( { } , c , { item : d . element } ) ; d . sortables = [ ] , a ( d . options . connectToSortable ) . each ( function ( ) { var c = a ( this ) . sortable ( "instance" ) ; c && ! c . options . disabled && ( d . sortables . push ( c ) ,
// refreshPositions is called at drag start to refresh the containerCache
// which is used in drag. This ensures it's initialized and synchronized
// with any changes that might have happened on the page since initialization.
c . refreshPositions ( ) , c . _trigger ( "activate" , b , e ) ) } ) } , stop : function ( b , c , d ) { var e = a . extend ( { } , c , { item : d . element } ) ; d . cancelHelperRemoval = ! 1 , a . each ( d . sortables , function ( ) { var a = this ; a . isOver ? ( a . isOver = 0 ,
// Allow this sortable to handle removing the helper
d . cancelHelperRemoval = ! 0 , a . cancelHelperRemoval = ! 1 ,
// Use _storedCSS To restore properties in the sortable,
// as this also handles revert (#9675) since the draggable
// may have modified them in unexpected ways (#8809)
a . _storedCSS = { position : a . placeholder . css ( "position" ) , top : a . placeholder . css ( "top" ) , left : a . placeholder . css ( "left" ) } , a . _mouseStop ( b ) ,
// Once drag has ended, the sortable should return to using
// its original helper, not the shared helper from draggable
a . options . helper = a . options . _helper ) : (
// Prevent this Sortable from removing the helper.
// However, don't set the draggable to remove the helper
// either as another connected Sortable may yet handle the removal.
a . cancelHelperRemoval = ! 0 , a . _trigger ( "deactivate" , b , e ) ) } ) } , drag : function ( b , c , d ) { a . each ( d . sortables , function ( ) { var e = ! 1 , f = this ;
// Copy over variables that sortable's _intersectsWith uses
f . positionAbs = d . positionAbs , f . helperProportions = d . helperProportions , f . offset . click = d . offset . click , f . _intersectsWith ( f . containerCache ) && ( e = ! 0 , a . each ( d . sortables , function ( ) { return this . positionAbs = d . positionAbs , this . helperProportions = d . helperProportions , this . offset . click = d . offset . click , this !== f && this . _intersectsWith ( this . containerCache ) && a . contains ( f . element [ 0 ] , this . element [ 0 ] ) && ( e = ! 1 ) , e } ) ) , e ? (
// If it intersects, we use a little isOver variable and set it once,
// so that the move-in stuff gets fired only once.
f . isOver || ( f . isOver = 1 ,
// Store draggable's parent in case we need to reappend to it later.
d . _parent = c . helper . parent ( ) , f . currentItem = c . helper . appendTo ( f . element ) . data ( "ui-sortable-item" , ! 0 ) ,
// Store helper option to later restore it
f . options . _helper = f . options . helper , f . options . helper = function ( ) { return c . helper [ 0 ] } ,
// Fire the start events of the sortable with our passed browser event,
// and our own helper (so it doesn't create a new one)
b . target = f . currentItem [ 0 ] , f . _mouseCapture ( b , ! 0 ) , f . _mouseStart ( b , ! 0 , ! 0 ) ,
// Because the browser event is way off the new appended portlet,
// modify necessary variables to reflect the changes
f . offset . click . top = d . offset . click . top , f . offset . click . left = d . offset . click . left , f . offset . parent . left -= d . offset . parent . left - f . offset . parent . left , f . offset . parent . top -= d . offset . parent . top - f . offset . parent . top , d . _trigger ( "toSortable" , b ) ,
// Inform draggable that the helper is in a valid drop zone,
// used solely in the revert option to handle "valid/invalid".
d . dropped = f . element ,
// Need to refreshPositions of all sortables in the case that
// adding to one sortable changes the location of the other sortables (#9675)
a . each ( d . sortables , function ( ) { this . refreshPositions ( ) } ) ,
// hack so receive/update callbacks work (mostly)
d . currentItem = d . element , f . fromOutside = d ) , f . currentItem && ( f . _mouseDrag ( b ) ,
// Copy the sortable's position because the draggable's can potentially reflect
// a relative position, while sortable is always absolute, which the dragged
// element has now become. (#8809)
c . position = f . position ) ) :
// If it doesn't intersect with the sortable, and it intersected before,
// we fake the drag stop of the sortable, but make sure it doesn't remove
// the helper by using cancelHelperRemoval.
f . isOver && ( f . isOver = 0 , f . cancelHelperRemoval = ! 0 ,
// Calling sortable's mouseStop would trigger a revert,
// so revert must be temporarily false until after mouseStop is called.
f . options . _revert = f . options . revert , f . options . revert = ! 1 , f . _trigger ( "out" , b , f . _uiHash ( f ) ) , f . _mouseStop ( b , ! 0 ) ,
// restore sortable behaviors that were modfied
// when the draggable entered the sortable area (#9481)
f . options . revert = f . options . _revert , f . options . helper = f . options . _helper , f . placeholder && f . placeholder . remove ( ) ,
// Restore and recalculate the draggable's offset considering the sortable
// may have modified them in unexpected ways. (#8809, #10669)
c . helper . appendTo ( d . _parent ) , d . _refreshOffsets ( b ) , c . position = d . _generatePosition ( b , ! 0 ) , d . _trigger ( "fromSortable" , b ) ,
// Inform draggable that the helper is no longer in a valid drop zone
d . dropped = ! 1 ,
// Need to refreshPositions of all sortables just in case removing
// from one sortable changes the location of other sortables (#9675)
a . each ( d . sortables , function ( ) { this . refreshPositions ( ) } ) ) } ) } } ) , a . ui . plugin . add ( "draggable" , "cursor" , { start : function ( b , c , d ) { var e = a ( "body" ) , f = d . options ; e . css ( "cursor" ) && ( f . _cursor = e . css ( "cursor" ) ) , e . css ( "cursor" , f . cursor ) } , stop : function ( b , c , d ) { var e = d . options ; e . _cursor && a ( "body" ) . css ( "cursor" , e . _cursor ) } } ) , a . ui . plugin . add ( "draggable" , "opacity" , { start : function ( b , c , d ) { var e = a ( c . helper ) , f = d . options ; e . css ( "opacity" ) && ( f . _opacity = e . css ( "opacity" ) ) , e . css ( "opacity" , f . opacity ) } , stop : function ( b , c , d ) { var e = d . options ; e . _opacity && a ( c . helper ) . css ( "opacity" , e . _opacity ) } } ) , a . ui . plugin . add ( "draggable" , "scroll" , { start : function ( a , b , c ) { c . scrollParentNotHidden || ( c . scrollParentNotHidden = c . helper . scrollParent ( ! 1 ) ) , c . scrollParentNotHidden [ 0 ] !== c . document [ 0 ] && "HTML" !== c . scrollParentNotHidden [ 0 ] . tagName && ( c . overflowOffset = c . scrollParentNotHidden . offset ( ) ) } , drag : function ( b , c , d ) { var e = d . options , f = ! 1 , g = d . scrollParentNotHidden [ 0 ] , h = d . document [ 0 ] ; g !== h && "HTML" !== g . tagName ? ( e . axis && "x" === e . axis || ( d . overflowOffset . top + g . offsetHeight - b . pageY < e . scrollSensitivity ? g . scrollTop = f = g . scrollTop + e . scrollSpeed : b . pageY - d . overflowOffset . top < e . scrollSensitivity && ( g . scrollTop = f = g . scrollTop - e . scrollSpeed ) ) , e . axis && "y" === e . axis || ( d . overflowOffset . left + g . offsetWidth - b . pageX < e . scrollSensitivity ? g . scrollLeft = f = g . scrollLeft + e . scrollSpeed : b . pageX - d . overflowOffset . left < e . scrollSensitivity && ( g . scrollLeft = f = g . scrollLeft - e . scrollSpeed ) ) ) : ( e . axis && "x" === e . axis || ( b . pageY - a ( h ) . scrollTop ( ) < e . scrollSensitivity ? f = a ( h ) . scrollTop ( a ( h ) . scrollTop ( ) - e . scrollSpeed ) : a ( window ) . height ( ) - ( b . pageY - a ( h ) . scrollTop ( ) ) < e . scrollSensitivity && ( f = a ( h ) . scrollTop ( a ( h ) . scrollTop ( ) + e . scrollSpeed ) ) ) , e . axis && "y" === e . axis || ( b . pageX - a ( h ) . scrollLeft ( ) < e . scrollSensitivity ? f = a ( h ) . scrollLeft ( a ( h ) . scrollLeft ( ) - e . scrollSpeed ) : a ( window ) . width ( ) - ( b . pageX - a ( h ) . scrollLeft ( ) ) < e . scrollSensitivity && ( f = a ( h ) . scrollLeft ( a ( h ) . scrollLeft ( ) + e . scrollSpeed ) ) ) ) , f !== ! 1 && a . ui . ddmanager && ! e . dropBehaviour && a . ui . ddmanager . prepareOffsets ( d , b ) } } ) , a . ui . plugin . add ( "draggable" , "snap" , { start : function ( b , c , d ) { var e = d . options ; d . snapElements = [ ] , a ( e . snap . constructor !== String ? e . snap . items || ":data(ui-draggable)" : e . snap ) . each ( function ( ) { var b = a ( this ) , c = b . offset ( ) ; this !== d . element [ 0 ] && d . snapElements . push ( { item : this , width : b . outerWidth ( ) , height : b . outerHeight ( ) , top : c . top , left : c . left } ) } ) } , drag : function ( b , c , d ) { var e , f , g , h , i , j , k , l , m , n , o = d . options , p = o . snapTolerance , q = c . offset . left , r = q + d . helperProportions . width , s = c . offset . top , t = s + d . helperProportions . height ; for ( m = d . snapElements . length - 1 ; m >= 0 ; m -- ) i = d . snapElements [ m ] . left - d . margins . left , j = i + d . snapElements [ m ] . width , k = d . snapElements [ m ] . top - d . margins . top , l = k + d . snapElements [ m ] . height , i - p > r || q > j + p || k - p > t || s > l + p || ! a . contains ( d . snapElements [ m ] . item . ownerDocument , d . snapElements [ m ] . item ) ? ( d . snapElements [ m ] . snapping && d . options . snap . release && d . options . snap . release . call ( d . element , b , a . extend ( d . _uiHash ( ) , { snapItem : d . snapElements [ m ] . item } ) ) , d . snapElements [ m ] . snapping = ! 1 ) : ( "inner" !== o . snapMode && ( e = Math . abs ( k - t ) <= p , f = Math . abs ( l - s ) <= p , g = Math . abs ( i - r ) <= p , h = Math . abs ( j - q ) <= p , e && ( c . position . top = d . _convertPositionTo ( "relative" , { top : k - d . helperProportions . height , left : 0 } ) . top ) , f && ( c . position . top = d . _convertPositionTo ( "relative" , { top : l , left : 0 } ) . top ) , g && ( c . position . left = d . _convertPositionTo ( "relative" , { top : 0 , left : i - d . helperProportions . width } ) . left ) , h && ( c . position . left = d . _convertPositionTo ( "relative" , { top : 0 , left : j } ) . left ) ) , n = e || f || g || h , "outer" !== o . snapMode && ( e = Math . abs ( k - s ) <= p , f = Math . abs ( l - t ) <= p , g = Math . abs ( i - q ) <= p , h = Math . abs ( j - r ) <= p , e && ( c . position . top = d . _convertPositionTo ( "relative" , { top : k , left : 0 } ) . top ) , f && ( c . position . top = d . _convertPositionTo ( "relative" , { top : l - d . helperProportions . height , left : 0 } ) . top ) , g && ( c . position . left = d . _convertPositionTo ( "relative" , { top : 0 , left : i } ) . left ) , h && ( c . position . left = d . _convertPositionTo ( "relative" , { top : 0 , left : j - d . helperProportions . width } ) . left ) ) , ! d . snapElements [ m ] . snapping && ( e || f || g || h || n ) && d . options . snap . snap && d . options . snap . snap . call ( d . element , b , a . extend ( d . _uiHash ( ) , { snapItem : d . snapElements [ m ] . item } ) ) , d . snapElements [ m ] . snapping = e || f || g || h || n ) } } ) , a . ui . plugin . add ( "draggable" , "stack" , { start : function ( b , c , d ) { var e , f = d .