diff options
Diffstat (limited to 'ui/jquery.ui.droppable.js')
-rw-r--r-- | ui/jquery.ui.droppable.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index a6959fd0f..35a260151 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -24,13 +24,13 @@ $.widget("ui.droppable", { version: "@VERSION", widgetEventPrefix: "drop", options: { - accept: '*', + accept: "*", activeClass: false, addClasses: true, greedy: false, hoverClass: false, - scope: 'default', - tolerance: 'intersect' + scope: "default", + tolerance: "intersect" }, _create: function() { @@ -70,7 +70,7 @@ $.widget("ui.droppable", { _setOption: function(key, value) { - if(key === 'accept') { + if(key === "accept") { this.accept = $.isFunction(value) ? value : function(d) { return d.is(value); }; @@ -84,7 +84,7 @@ $.widget("ui.droppable", { this.element.addClass(this.options.activeClass); } if(draggable){ - this._trigger('activate', event, this.ui(draggable)); + this._trigger("activate", event, this.ui(draggable)); } }, @@ -94,7 +94,7 @@ $.widget("ui.droppable", { this.element.removeClass(this.options.activeClass); } if(draggable){ - this._trigger('deactivate', event, this.ui(draggable)); + this._trigger("deactivate", event, this.ui(draggable)); } }, @@ -111,7 +111,7 @@ $.widget("ui.droppable", { if(this.options.hoverClass) { this.element.addClass(this.options.hoverClass); } - this._trigger('over', event, this.ui(draggable)); + this._trigger("over", event, this.ui(draggable)); } }, @@ -129,7 +129,7 @@ $.widget("ui.droppable", { if(this.options.hoverClass) { this.element.removeClass(this.options.hoverClass); } - this._trigger('out', event, this.ui(draggable)); + this._trigger("out", event, this.ui(draggable)); } }, @@ -145,7 +145,7 @@ $.widget("ui.droppable", { } this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { - var inst = $.data(this, 'ui-droppable'); + var inst = $.data(this, "ui-droppable"); if( inst.options.greedy && !inst.options.disabled && @@ -165,7 +165,7 @@ $.widget("ui.droppable", { if(this.options.hoverClass) { this.element.removeClass(this.options.hoverClass); } - this._trigger('drop', event, this.ui(draggable)); + this._trigger("drop", event, this.ui(draggable)); return this.element; } @@ -197,18 +197,18 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { t = droppable.offset.top, b = t + droppable.proportions.height; switch (toleranceMode) { - case 'fit': + case "fit": return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); - case 'intersect': + case "intersect": return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half x2 - (draggable.helperProportions.width / 2) < r && // Left Half t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - case 'pointer': + case "pointer": draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left); draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top); return isOverAxis( draggableTop, t, droppable.proportions.height ) && isOverAxis( draggableLeft, l, droppable.proportions.width ); - case 'touch': + case "touch": return ( (y1 >= t && y1 <= b) || // Top edge touching (y2 >= t && y2 <= b) || // Bottom edge touching @@ -229,7 +229,7 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { */ $.ui.ddmanager = { current: null, - droppables: { 'default': [] }, + droppables: { "default": [] }, prepareOffsets: function(t, event) { var i, j, @@ -314,7 +314,7 @@ $.ui.ddmanager = { var parentInstance, scope, parent, intersects = $.ui.intersect(draggable, this, this.options.tolerance), - c = !intersects && this.isover ? 'isout' : (intersects && !this.isover ? 'isover' : null); + c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null); if(!c) { return; } @@ -322,29 +322,29 @@ $.ui.ddmanager = { if (this.options.greedy) { // find droppable parents with same scope scope = this.options.scope; - parent = this.element.parents(':data(ui-droppable)').filter(function () { - return $.data(this, 'ui-droppable').options.scope === scope; + parent = this.element.parents(":data(ui-droppable)").filter(function () { + return $.data(this, "ui-droppable").options.scope === scope; }); if (parent.length) { - parentInstance = $.data(parent[0], 'ui-droppable'); - parentInstance.greedyChild = (c === 'isover'); + parentInstance = $.data(parent[0], "ui-droppable"); + parentInstance.greedyChild = (c === "isover"); } } // we just moved into a greedy child - if (parentInstance && c === 'isover') { + if (parentInstance && c === "isover") { parentInstance.isover = false; parentInstance.isout = true; parentInstance._out.call(parentInstance, event); } this[c] = true; - this[c === 'isout' ? 'isover' : 'isout'] = false; + this[c === "isout" ? "isover" : "isout"] = false; this[c === "isover" ? "_over" : "_out"].call(this, event); // we just moved out of a greedy child - if (parentInstance && c === 'isout') { + if (parentInstance && c === "isout") { parentInstance.isout = false; parentInstance.isover = true; parentInstance._over.call(parentInstance, event); |