diff options
author | Richard Worth <rdworth@gmail.com> | 2008-11-21 04:01:33 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2008-11-21 04:01:33 +0000 |
commit | fb94a4e34e25941443bdd7c52c41844e29f2db9f (patch) | |
tree | b54be3ceb6429136d862abc5cd9dd8310a4fc25b /ui/ui.droppable.js | |
parent | 2192c024e2b8dd4b3a27170400107400dc5a72b4 (diff) | |
download | jquery-ui-fb94a4e34e25941443bdd7c52c41844e29f2db9f.tar.gz jquery-ui-fb94a4e34e25941443bdd7c52c41844e29f2db9f.zip |
draggable, droppable, resizable, selectable, sortable: formatting changes - moved some things around for consistency.
_init and destroy at the top, then _mouse methods. plugins, ui last. Sorted defaults and plugins alphabetically.
Diffstat (limited to 'ui/ui.droppable.js')
-rw-r--r-- | ui/ui.droppable.js | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js index b3e0299cf..e61883758 100644 --- a/ui/ui.droppable.js +++ b/ui/ui.droppable.js @@ -15,18 +15,6 @@ $.widget("ui.droppable", { - _setData: function(key, value) { - - if(key == 'accept') { - this.options.accept = value && $.isFunction(value) ? value : function(d) { - return d.is(accept); - }; - } else { - $.widget.prototype._setData.apply(this, arguments); - } - - }, - _init: function() { var o = this.options, accept = o.accept; @@ -46,17 +34,7 @@ $.widget("ui.droppable", { (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable")); }, - plugins: {}, - ui: function(c) { - return { - draggable: (c.currentItem || c.element), - helper: c.helper, - position: c.position, - absolutePosition: c.positionAbs, - options: this.options, - element: this.element - }; - }, + destroy: function() { var drop = $.ui.ddmanager.droppables[this.options.scope]; for ( var i = 0; i < drop.length; i++ ) @@ -68,6 +46,35 @@ $.widget("ui.droppable", { .removeData("droppable") .unbind(".droppable"); }, + + _setData: function(key, value) { + + if(key == 'accept') { + this.options.accept = value && $.isFunction(value) ? value : function(d) { + return d.is(accept); + }; + } else { + $.widget.prototype._setData.apply(this, arguments); + } + + }, + + _activate: function(event) { + + var draggable = $.ui.ddmanager.current; + $.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]); + if(draggable) this.element.triggerHandler("dropactivate", [event, this.ui(draggable)], this.options.activate); + + }, + + _deactivate: function(event) { + + var draggable = $.ui.ddmanager.current; + $.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]); + if(draggable) this.element.triggerHandler("dropdeactivate", [event, this.ui(draggable)], this.options.deactivate); + + }, + _over: function(event) { var draggable = $.ui.ddmanager.current; @@ -79,6 +86,7 @@ $.widget("ui.droppable", { } }, + _out: function(event) { var draggable = $.ui.ddmanager.current; @@ -90,6 +98,7 @@ $.widget("ui.droppable", { } }, + _drop: function(event,custom) { var draggable = custom || $.ui.ddmanager.current; @@ -113,20 +122,20 @@ $.widget("ui.droppable", { return false; }, - _activate: function(event) { - - var draggable = $.ui.ddmanager.current; - $.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]); - if(draggable) this.element.triggerHandler("dropactivate", [event, this.ui(draggable)], this.options.activate); - - }, - _deactivate: function(event) { - var draggable = $.ui.ddmanager.current; - $.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]); - if(draggable) this.element.triggerHandler("dropdeactivate", [event, this.ui(draggable)], this.options.deactivate); + plugins: {}, + ui: function(c) { + return { + draggable: (c.currentItem || c.element), + helper: c.helper, + position: c.position, + absolutePosition: c.positionAbs, + options: this.options, + element: this.element + }; } + }); $.extend($.ui.droppable, { |