Skip to content

Commit

Permalink
droppable: removed all instances of $.ui.plugin, fairly safe here (fi…
Browse files Browse the repository at this point in the history
…xes #3723)
  • Loading branch information
Paul Bakaus committed Jan 16, 2009
1 parent 79647cd commit be932c2
Showing 1 changed file with 6 additions and 37 deletions.
43 changes: 6 additions & 37 deletions ui/ui.droppable.js
Expand Up @@ -60,19 +60,15 @@ $.widget("ui.droppable", {
}, },


_activate: function(event) { _activate: function(event) {

var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]); if(this.options.activeClass) this.element.addClass(ui.options.activeClass);
(draggable && this._trigger('activate', event, this.ui(draggable))); (draggable && this._trigger('activate', event, this.ui(draggable)));

}, },


_deactivate: function(event) { _deactivate: function(event) {

var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]); if(this.options.activeClass) this.element.removeClass(ui.options.activeClass);
(draggable && this._trigger('deactivate', event, this.ui(draggable))); (draggable && this._trigger('deactivate', event, this.ui(draggable)));

}, },


_over: function(event) { _over: function(event) {
Expand All @@ -81,7 +77,7 @@ $.widget("ui.droppable", {
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element


if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'over', [event, this.ui(draggable)]); if(this.options.hoverClass) this.element.addClass(ui.options.hoverClass);
this._trigger('over', event, this.ui(draggable)); this._trigger('over', event, this.ui(draggable));
} }


Expand All @@ -93,7 +89,7 @@ $.widget("ui.droppable", {
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element


if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'out', [event, this.ui(draggable)]); if(this.options.hoverClass) this.element.removeClass(ui.options.hoverClass);
this._trigger('out', event, this.ui(draggable)); this._trigger('out', event, this.ui(draggable));
} }


Expand All @@ -114,7 +110,8 @@ $.widget("ui.droppable", {
if(childrenIntersection) return false; if(childrenIntersection) return false;


if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) { if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
$.ui.plugin.call(this, 'drop', [event, this.ui(draggable)]); if(this.options.activeClass) this.element.removeClass(ui.options.activeClass);
if(this.options.hoverClass) this.element.removeClass(ui.options.hoverClass);
this._trigger('drop', event, this.ui(draggable)); this._trigger('drop', event, this.ui(draggable));
return this.element; return this.element;
} }
Expand Down Expand Up @@ -285,32 +282,4 @@ $.ui.ddmanager = {
} }
}; };


/*
* Droppable Extensions
*/

$.ui.plugin.add("droppable", "activeClass", {
activate: function(event, ui) {
$(this).addClass(ui.options.activeClass);
},
deactivate: function(event, ui) {
$(this).removeClass(ui.options.activeClass);
},
drop: function(event, ui) {
$(this).removeClass(ui.options.activeClass);
}
});

$.ui.plugin.add("droppable", "hoverClass", {
over: function(event, ui) {
$(this).addClass(ui.options.hoverClass);
},
out: function(event, ui) {
$(this).removeClass(ui.options.hoverClass);
},
drop: function(event, ui) {
$(this).removeClass(ui.options.hoverClass);
}
});

})(jQuery); })(jQuery);

0 comments on commit be932c2

Please sign in to comment.