Merge "Added result properties to action=paraminfo"
[lhc/web/wiklou.git] / resources / jquery.ui / jquery.ui.sortable.js
index 3438f59..45fbb1c 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * jQuery UI Sortable 1.8.20
+ * jQuery UI Sortable 1.8.21
  *
  * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT or GPL Version 2 licenses.
@@ -155,11 +155,6 @@ $.widget("ui.sortable", $.ui.mouse, {
                        left: this.offset.left - this.margins.left
                };
 
-               // Only after we got the offset, we can change the helper's position to absolute
-               // TODO: Still need to figure out a way to make relative sorting possible
-               this.helper.css("position", "absolute");
-               this.cssPosition = this.helper.css("position");
-
                $.extend(this.offset, {
                        click: { //Where the click happened, relative to the element
                                left: event.pageX - this.offset.left,
@@ -169,6 +164,11 @@ $.widget("ui.sortable", $.ui.mouse, {
                        relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
                });
 
+               // Only after we got the offset, we can change the helper's position to absolute
+               // TODO: Still need to figure out a way to make relative sorting possible
+               this.helper.css("position", "absolute");
+               this.cssPosition = this.helper.css("position");
+               
                //Generate the original position
                this.originalPosition = this._generatePosition(event);
                this.originalPageX = event.pageX;
@@ -730,30 +730,31 @@ $.widget("ui.sortable", $.ui.mouse, {
                if(this.containers.length === 1) {
                        this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                        this.containers[innermostIndex].containerCache.over = 1;
-               } else if(this.currentContainer != this.containers[innermostIndex]) { 
-
-                       //When entering a new container, we will find the item with the least distance and append our item near it 
-                       var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; 
-                       for (var j = this.items.length - 1; j >= 0; j--) { 
-                               if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; 
-                               var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top']; 
-                               if(Math.abs(cur - base) < dist) { 
-                                       dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; 
-                               } 
-                       } 
-
-                       if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled 
-                               return; 
-
-                       this.currentContainer = this.containers[innermostIndex]; 
-                       itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); 
-                       this._trigger("change", event, this._uiHash()); 
-                       this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); 
-
-                       //Update the placeholder 
-                       this.options.placeholder.update(this.currentContainer, this.placeholder); 
-               
-                       this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); 
+               } else if(this.currentContainer != this.containers[innermostIndex]) {
+
+                       //When entering a new container, we will find the item with the least distance and append our item near it
+                       var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
+                       for (var j = this.items.length - 1; j >= 0; j--) {
+                               if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+                               var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
+                               if(Math.abs(cur - base) < dist) {
+                                       dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+                                       this.direction = (cur - base > 0) ? 'down' : 'up';
+                               }
+                       }
+
+                       if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+                               return;
+
+                       this.currentContainer = this.containers[innermostIndex];
+                       itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+                       this._trigger("change", event, this._uiHash());
+                       this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+                       //Update the placeholder
+                       this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+                       this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                        this.containers[innermostIndex].containerCache.over = 1;
                } 
        
@@ -1075,7 +1076,7 @@ $.widget("ui.sortable", $.ui.mouse, {
 });
 
 $.extend($.ui.sortable, {
-       version: "1.8.20"
+       version: "1.8.21"
 });
 
 })(jQuery);