From be932c2e58f9c47daa658ecf5775142b1c1a3d21 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Fri, 16 Jan 2009 14:51:56 +0000 Subject: [PATCH] droppable: removed all instances of $.ui.plugin, fairly safe here (fixes #3723) --- ui/ui.droppable.js | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js index 1d2f27e75..623467411 100644 --- a/ui/ui.droppable.js +++ b/ui/ui.droppable.js @@ -60,19 +60,15 @@ $.widget("ui.droppable", { }, _activate: function(event) { - 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))); - }, _deactivate: function(event) { - 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))); - }, _over: function(event) { @@ -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 (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)); } @@ -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 (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)); } @@ -114,7 +110,8 @@ $.widget("ui.droppable", { if(childrenIntersection) return false; 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)); return this.element; } @@ -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);