|
|
@ -38,18 +38,13 @@ |
|
|
|
, parseInt = win.parseInt |
|
|
|
, parseInt = win.parseInt |
|
|
|
, _silent = false |
|
|
|
, _silent = false |
|
|
|
|
|
|
|
|
|
|
|
, Event = (function (){ |
|
|
|
, _createEvent = function (event/**String*/, item/**HTMLElement*/){ |
|
|
|
function CustomEvent(event, params){ |
|
|
|
var evt = document.createEvent('Event'); |
|
|
|
var evt = document.createEvent('CustomEvent'); |
|
|
|
evt.initEvent(event, true, true); |
|
|
|
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); |
|
|
|
evt.item = item; |
|
|
|
return evt; |
|
|
|
return evt; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CustomEvent.prototype = win.CustomEvent.prototype; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return CustomEvent; |
|
|
|
|
|
|
|
})() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
, noop = function (){} |
|
|
|
, noop = function (){} |
|
|
|
, slice = [].slice |
|
|
|
, slice = [].slice |
|
|
|
|
|
|
|
|
|
|
@ -132,6 +127,7 @@ |
|
|
|
tapEvt = evt; |
|
|
|
tapEvt = evt; |
|
|
|
target.draggable = true; |
|
|
|
target.draggable = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Disable "draggable"
|
|
|
|
// Disable "draggable"
|
|
|
|
_find(target, 'a', _disableDraggable); |
|
|
|
_find(target, 'a', _disableDraggable); |
|
|
|
_find(target, 'img', _disableDraggable); |
|
|
|
_find(target, 'img', _disableDraggable); |
|
|
@ -262,11 +258,11 @@ |
|
|
|
, target = _closest(evt.target, this.options.draggable, el) |
|
|
|
, target = _closest(evt.target, this.options.draggable, el) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
if( target[expando] === void 0 ){ |
|
|
|
if( target && target[expando] === void 0 ){ |
|
|
|
if( el.children.length === 0 ){ |
|
|
|
if( el.children.length === 0 ){ |
|
|
|
el.appendChild(dragEl); |
|
|
|
el.appendChild(dragEl); |
|
|
|
} |
|
|
|
} |
|
|
|
else if( target && (target !== dragEl) ){ |
|
|
|
else if( target !== dragEl ){ |
|
|
|
if( lastEl !== target ){ |
|
|
|
if( lastEl !== target ){ |
|
|
|
lastEl = target; |
|
|
|
lastEl = target; |
|
|
|
lastCSS = _css(target) |
|
|
|
lastCSS = _css(target) |
|
|
@ -327,20 +323,18 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( dragEl ){ |
|
|
|
if( dragEl ){ |
|
|
|
var opts = { bubbles: true, cancelable: true, detail: dragEl }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_toggleClass(dragEl, this.options.ghostClass, false); |
|
|
|
_toggleClass(dragEl, this.options.ghostClass, false); |
|
|
|
|
|
|
|
|
|
|
|
if( !rootEl.contains(dragEl) ){ |
|
|
|
if( !rootEl.contains(dragEl) ){ |
|
|
|
// Remove event
|
|
|
|
// Remove event
|
|
|
|
rootEl.dispatchEvent(new Event('remove', opts)); |
|
|
|
rootEl.dispatchEvent(_createEvent('remove', dragEl)); |
|
|
|
|
|
|
|
|
|
|
|
// Add event
|
|
|
|
// Add event
|
|
|
|
dragEl.dispatchEvent(new Event('add', opts)); |
|
|
|
dragEl.dispatchEvent(_createEvent('add', dragEl)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if( dragEl.nextSibling !== nextEl ){ |
|
|
|
else if( dragEl.nextSibling !== nextEl ){ |
|
|
|
// Update event
|
|
|
|
// Update event
|
|
|
|
dragEl.dispatchEvent(new Event('update', opts)); |
|
|
|
dragEl.dispatchEvent(_createEvent('update', dragEl)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -500,7 +494,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '0.1.3'; |
|
|
|
Sortable.version = '0.1.4'; |
|
|
|
|
|
|
|
|
|
|
|
// Export
|
|
|
|
// Export
|
|
|
|
return Sortable; |
|
|
|
return Sortable; |
|
|
|