jquery-ui-rails 2.0.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-ui-rails might be problematic. Click here for more details.

Files changed (131) hide show
  1. data/History.md +15 -0
  2. data/License.txt +2 -3
  3. data/README.md +17 -19
  4. data/Rakefile +79 -28
  5. data/lib/jquery/ui/rails/version.rb +1 -1
  6. data/vendor/assets/javascripts/jquery.ui.accordion.js +537 -417
  7. data/vendor/assets/javascripts/jquery.ui.all.js +17 -14
  8. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +311 -339
  9. data/vendor/assets/javascripts/jquery.ui.button.js +63 -59
  10. data/vendor/assets/javascripts/jquery.ui.core.js +134 -112
  11. data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +2 -2
  12. data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +3 -3
  13. data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +3 -3
  14. data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +16 -16
  15. data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +5 -5
  16. data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +13 -13
  17. data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +3 -3
  18. data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +1 -1
  19. data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +9 -9
  20. data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +2 -2
  21. data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +1 -1
  22. data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +2 -2
  23. data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +6 -6
  24. data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +1 -1
  25. data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +3 -3
  26. data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +3 -3
  27. data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +5 -5
  28. data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +3 -3
  29. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +3 -3
  30. data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +2 -2
  31. data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +6 -6
  32. data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +2 -2
  33. data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +3 -3
  34. data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +3 -3
  35. data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +3 -3
  36. data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +11 -11
  37. data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +3 -3
  38. data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +3 -3
  39. data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +2 -2
  40. data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +1 -1
  41. data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +3 -3
  42. data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +1 -1
  43. data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +1 -1
  44. data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +3 -3
  45. data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +1 -1
  46. data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +18 -18
  47. data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +2 -2
  48. data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +7 -7
  49. data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +6 -6
  50. data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +2 -2
  51. data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +2 -2
  52. data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +3 -3
  53. data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +2 -2
  54. data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +6 -6
  55. data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +2 -2
  56. data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +2 -2
  57. data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +2 -2
  58. data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +9 -9
  59. data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +3 -3
  60. data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +1 -1
  61. data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +2 -2
  62. data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +3 -3
  63. data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +2 -2
  64. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +2 -2
  65. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +2 -2
  66. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +2 -2
  67. data/vendor/assets/javascripts/jquery.ui.datepicker.js +51 -59
  68. data/vendor/assets/javascripts/jquery.ui.dialog.js +402 -409
  69. data/vendor/assets/javascripts/jquery.ui.draggable.js +79 -75
  70. data/vendor/assets/javascripts/jquery.ui.droppable.js +10 -17
  71. data/vendor/assets/javascripts/jquery.ui.effect-blind.js +84 -0
  72. data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
  73. data/vendor/assets/javascripts/jquery.ui.effect-clip.js +69 -0
  74. data/vendor/assets/javascripts/jquery.ui.effect-drop.js +67 -0
  75. data/vendor/assets/javascripts/jquery.ui.effect-explode.js +99 -0
  76. data/vendor/assets/javascripts/jquery.ui.effect-fade.js +32 -0
  77. data/vendor/assets/javascripts/jquery.ui.effect-fold.js +78 -0
  78. data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
  79. data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
  80. data/vendor/assets/javascripts/jquery.ui.effect-scale.js +320 -0
  81. data/vendor/assets/javascripts/jquery.ui.effect-shake.js +76 -0
  82. data/vendor/assets/javascripts/jquery.ui.effect-slide.js +66 -0
  83. data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
  84. data/vendor/assets/javascripts/jquery.ui.effect.all.js +14 -0
  85. data/vendor/assets/javascripts/jquery.ui.effect.js +1276 -0
  86. data/vendor/assets/javascripts/jquery.ui.menu.js +614 -0
  87. data/vendor/assets/javascripts/jquery.ui.mouse.js +22 -20
  88. data/vendor/assets/javascripts/jquery.ui.position.js +367 -158
  89. data/vendor/assets/javascripts/jquery.ui.progressbar.js +10 -14
  90. data/vendor/assets/javascripts/jquery.ui.resizable.js +143 -149
  91. data/vendor/assets/javascripts/jquery.ui.selectable.js +22 -28
  92. data/vendor/assets/javascripts/jquery.ui.slider.js +88 -106
  93. data/vendor/assets/javascripts/jquery.ui.sortable.js +97 -95
  94. data/vendor/assets/javascripts/jquery.ui.spinner.js +482 -0
  95. data/vendor/assets/javascripts/jquery.ui.tabs.js +1189 -580
  96. data/vendor/assets/javascripts/jquery.ui.tooltip.js +402 -0
  97. data/vendor/assets/javascripts/jquery.ui.widget.js +373 -117
  98. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +10 -13
  99. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +4 -3
  100. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +10 -44
  101. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +7 -3
  102. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +6 -4
  103. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +5 -4
  104. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +4 -3
  105. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +6 -5
  106. data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +34 -0
  107. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +4 -3
  108. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +4 -3
  109. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +4 -3
  110. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +4 -3
  111. data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +27 -0
  112. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +8 -8
  113. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +8 -7
  114. data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +25 -0
  115. metadata +24 -19
  116. data/dependencies.js +0 -31
  117. data/vendor/assets/javascripts/jquery.effects.all.js +0 -14
  118. data/vendor/assets/javascripts/jquery.effects.blind.js +0 -51
  119. data/vendor/assets/javascripts/jquery.effects.bounce.js +0 -80
  120. data/vendor/assets/javascripts/jquery.effects.clip.js +0 -56
  121. data/vendor/assets/javascripts/jquery.effects.core.js +0 -612
  122. data/vendor/assets/javascripts/jquery.effects.drop.js +0 -52
  123. data/vendor/assets/javascripts/jquery.effects.explode.js +0 -81
  124. data/vendor/assets/javascripts/jquery.effects.fade.js +0 -34
  125. data/vendor/assets/javascripts/jquery.effects.fold.js +0 -58
  126. data/vendor/assets/javascripts/jquery.effects.highlight.js +0 -52
  127. data/vendor/assets/javascripts/jquery.effects.pulsate.js +0 -53
  128. data/vendor/assets/javascripts/jquery.effects.scale.js +0 -180
  129. data/vendor/assets/javascripts/jquery.effects.shake.js +0 -59
  130. data/vendor/assets/javascripts/jquery.effects.slide.js +0 -52
  131. data/vendor/assets/javascripts/jquery.effects.transfer.js +0 -47
@@ -3,13 +3,14 @@
3
3
  //= require jquery.ui.mouse
4
4
 
5
5
  /*!
6
- * jQuery UI Sortable 1.8.24
6
+ * jQuery UI Sortable 1.9.2
7
+ * http://jqueryui.com
7
8
  *
8
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
9
- * Dual licensed under the MIT or GPL Version 2 licenses.
9
+ * Copyright 2012 jQuery Foundation and other contributors
10
+ * Released under the MIT license.
10
11
  * http://jquery.org/license
11
12
  *
12
- * http://docs.jquery.com/UI/Sortables
13
+ * http://api.jqueryui.com/sortable/
13
14
  *
14
15
  * Depends:
15
16
  * jquery.ui.core.js
@@ -19,6 +20,7 @@
19
20
  (function( $, undefined ) {
20
21
 
21
22
  $.widget("ui.sortable", $.ui.mouse, {
23
+ version: "1.9.2",
22
24
  widgetEventPrefix: "sort",
23
25
  ready: false,
24
26
  options: {
@@ -62,14 +64,13 @@ $.widget("ui.sortable", $.ui.mouse, {
62
64
 
63
65
  //Initialize mouse events for interaction
64
66
  this._mouseInit();
65
-
67
+
66
68
  //We're ready to go
67
69
  this.ready = true
68
70
 
69
71
  },
70
72
 
71
- destroy: function() {
72
- $.Widget.prototype.destroy.call( this );
73
+ _destroy: function() {
73
74
  this.element
74
75
  .removeClass("ui-sortable ui-sortable-disabled");
75
76
  this._mouseDestroy();
@@ -83,9 +84,8 @@ $.widget("ui.sortable", $.ui.mouse, {
83
84
  _setOption: function(key, value){
84
85
  if ( key === "disabled" ) {
85
86
  this.options[ key ] = value;
86
-
87
- this.widget()
88
- [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
87
+
88
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
89
89
  } else {
90
90
  // Don't call widget base _setOption for disable as it adds ui-state-disabled class
91
91
  $.Widget.prototype._setOption.apply(this, arguments);
@@ -105,13 +105,13 @@ $.widget("ui.sortable", $.ui.mouse, {
105
105
  this._refreshItems(event);
106
106
 
107
107
  //Find out if the clicked node (or one of its parents) is a actual item in this.items
108
- var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
109
- if($.data(this, that.widgetName + '-item') == self) {
108
+ var currentItem = null, nodes = $(event.target).parents().each(function() {
109
+ if($.data(this, that.widgetName + '-item') == that) {
110
110
  currentItem = $(this);
111
111
  return false;
112
112
  }
113
113
  });
114
- if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
114
+ if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
115
115
 
116
116
  if(!currentItem) return false;
117
117
  if(this.options.handle && !overrideHandle) {
@@ -129,7 +129,7 @@ $.widget("ui.sortable", $.ui.mouse, {
129
129
 
130
130
  _mouseStart: function(event, overrideHandle, noActivation) {
131
131
 
132
- var o = this.options, self = this;
132
+ var o = this.options;
133
133
  this.currentContainer = this;
134
134
 
135
135
  //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
@@ -172,7 +172,7 @@ $.widget("ui.sortable", $.ui.mouse, {
172
172
  // TODO: Still need to figure out a way to make relative sorting possible
173
173
  this.helper.css("position", "absolute");
174
174
  this.cssPosition = this.helper.css("position");
175
-
175
+
176
176
  //Generate the original position
177
177
  this.originalPosition = this._generatePosition(event);
178
178
  this.originalPageX = event.pageX;
@@ -225,7 +225,7 @@ $.widget("ui.sortable", $.ui.mouse, {
225
225
 
226
226
  //Post 'activate' events to possible containers
227
227
  if(!noActivation) {
228
- for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
228
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
229
229
  }
230
230
 
231
231
  //Prepare possible droppables
@@ -311,8 +311,8 @@ $.widget("ui.sortable", $.ui.mouse, {
311
311
 
312
312
  if (itemElement != this.currentItem[0] //cannot intersect with itself
313
313
  && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
314
- && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
315
- && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
314
+ && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
315
+ && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
316
316
  //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
317
317
  ) {
318
318
 
@@ -352,16 +352,16 @@ $.widget("ui.sortable", $.ui.mouse, {
352
352
  $.ui.ddmanager.drop(this, event);
353
353
 
354
354
  if(this.options.revert) {
355
- var self = this;
356
- var cur = self.placeholder.offset();
355
+ var that = this;
356
+ var cur = this.placeholder.offset();
357
357
 
358
- self.reverting = true;
358
+ this.reverting = true;
359
359
 
360
360
  $(this.helper).animate({
361
- left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
362
- top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
361
+ left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
362
+ top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
363
363
  }, parseInt(this.options.revert, 10) || 500, function() {
364
- self._clear(event);
364
+ that._clear(event);
365
365
  });
366
366
  } else {
367
367
  this._clear(event, noPropagation);
@@ -373,8 +373,6 @@ $.widget("ui.sortable", $.ui.mouse, {
373
373
 
374
374
  cancel: function() {
375
375
 
376
- var self = this;
377
-
378
376
  if(this.dragging) {
379
377
 
380
378
  this._mouseUp({ target: null });
@@ -386,9 +384,9 @@ $.widget("ui.sortable", $.ui.mouse, {
386
384
 
387
385
  //Post deactivating events to containers
388
386
  for (var i = this.containers.length - 1; i >= 0; i--){
389
- this.containers[i]._trigger("deactivate", null, self._uiHash(this));
387
+ this.containers[i]._trigger("deactivate", null, this._uiHash(this));
390
388
  if(this.containers[i].containerCache.over) {
391
- this.containers[i]._trigger("out", null, self._uiHash(this));
389
+ this.containers[i]._trigger("out", null, this._uiHash(this));
392
390
  this.containers[i].containerCache.over = 0;
393
391
  }
394
392
  }
@@ -533,10 +531,9 @@ $.widget("ui.sortable", $.ui.mouse, {
533
531
  ? [options.connectWith]
534
532
  : options.connectWith;
535
533
  },
536
-
534
+
537
535
  _getItemsAsjQuery: function(connected) {
538
536
 
539
- var self = this;
540
537
  var items = [];
541
538
  var queries = [];
542
539
  var connectWith = this._connectWith();
@@ -569,14 +566,13 @@ $.widget("ui.sortable", $.ui.mouse, {
569
566
 
570
567
  var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
571
568
 
572
- for (var i=0; i < this.items.length; i++) {
573
-
569
+ this.items = $.grep(this.items, function (item) {
574
570
  for (var j=0; j < list.length; j++) {
575
- if(list[j] == this.items[i].item[0])
576
- this.items.splice(i,1);
571
+ if(list[j] == item.item[0])
572
+ return false;
577
573
  };
578
-
579
- };
574
+ return true;
575
+ });
580
576
 
581
577
  },
582
578
 
@@ -585,7 +581,6 @@ $.widget("ui.sortable", $.ui.mouse, {
585
581
  this.items = [];
586
582
  this.containers = [this];
587
583
  var items = this.items;
588
- var self = this;
589
584
  var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
590
585
  var connectWith = this._connectWith();
591
586
 
@@ -664,16 +659,16 @@ $.widget("ui.sortable", $.ui.mouse, {
664
659
  },
665
660
 
666
661
  _createPlaceholder: function(that) {
667
-
668
- var self = that || this, o = self.options;
662
+ that = that || this;
663
+ var o = that.options;
669
664
 
670
665
  if(!o.placeholder || o.placeholder.constructor == String) {
671
666
  var className = o.placeholder;
672
667
  o.placeholder = {
673
668
  element: function() {
674
669
 
675
- var el = $(document.createElement(self.currentItem[0].nodeName))
676
- .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
670
+ var el = $(document.createElement(that.currentItem[0].nodeName))
671
+ .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
677
672
  .removeClass("ui-sortable-helper")[0];
678
673
 
679
674
  if(!className)
@@ -688,46 +683,46 @@ $.widget("ui.sortable", $.ui.mouse, {
688
683
  if(className && !o.forcePlaceholderSize) return;
689
684
 
690
685
  //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
691
- if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
692
- if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
686
+ if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
687
+ if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
693
688
  }
694
689
  };
695
690
  }
696
691
 
697
692
  //Create the placeholder
698
- self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
693
+ that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
699
694
 
700
695
  //Append it after the actual current item
701
- self.currentItem.after(self.placeholder);
696
+ that.currentItem.after(that.placeholder);
702
697
 
703
698
  //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
704
- o.placeholder.update(self, self.placeholder);
699
+ o.placeholder.update(that, that.placeholder);
705
700
 
706
701
  },
707
702
 
708
703
  _contactContainers: function(event) {
709
-
710
- // get innermost container that intersects with item
711
- var innermostContainer = null, innermostIndex = null;
712
-
713
-
704
+
705
+ // get innermost container that intersects with item
706
+ var innermostContainer = null, innermostIndex = null;
707
+
708
+
714
709
  for (var i = this.containers.length - 1; i >= 0; i--){
715
710
 
716
- // never consider a container that's located within the item itself
717
- if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
711
+ // never consider a container that's located within the item itself
712
+ if($.contains(this.currentItem[0], this.containers[i].element[0]))
718
713
  continue;
719
714
 
720
715
  if(this._intersectsWith(this.containers[i].containerCache)) {
721
716
 
722
- // if we've already found a container and it's more "inner" than this, then continue
723
- if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
717
+ // if we've already found a container and it's more "inner" than this, then continue
718
+ if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
724
719
  continue;
725
720
 
726
- innermostContainer = this.containers[i];
721
+ innermostContainer = this.containers[i];
727
722
  innermostIndex = i;
728
-
723
+
729
724
  } else {
730
- // container doesn't intersect. trigger "out" event if necessary
725
+ // container doesn't intersect. trigger "out" event if necessary
731
726
  if(this.containers[i].containerCache.over) {
732
727
  this.containers[i]._trigger("out", event, this._uiHash(this));
733
728
  this.containers[i].containerCache.over = 0;
@@ -735,24 +730,34 @@ $.widget("ui.sortable", $.ui.mouse, {
735
730
  }
736
731
 
737
732
  }
738
-
739
- // if no intersecting containers found, return
740
- if(!innermostContainer) return;
733
+
734
+ // if no intersecting containers found, return
735
+ if(!innermostContainer) return;
741
736
 
742
737
  // move the item into the container if it's not there already
743
738
  if(this.containers.length === 1) {
744
739
  this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
745
740
  this.containers[innermostIndex].containerCache.over = 1;
746
- } else if(this.currentContainer != this.containers[innermostIndex]) {
741
+ } else {
747
742
 
748
743
  //When entering a new container, we will find the item with the least distance and append our item near it
749
- var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
744
+ var dist = 10000; var itemWithLeastDistance = null;
745
+ var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
746
+ var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
747
+ var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
750
748
  for (var j = this.items.length - 1; j >= 0; j--) {
751
- if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
752
- var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;
749
+ if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
750
+ if(this.items[j].item[0] == this.currentItem[0]) continue;
751
+ var cur = this.items[j].item.offset()[posProperty];
752
+ var nearBottom = false;
753
+ if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
754
+ nearBottom = true;
755
+ cur += this.items[j][sizeProperty];
756
+ }
757
+
753
758
  if(Math.abs(cur - base) < dist) {
754
759
  dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
755
- this.direction = (cur - base > 0) ? 'down' : 'up';
760
+ this.direction = nearBottom ? "up": "down";
756
761
  }
757
762
  }
758
763
 
@@ -769,9 +774,9 @@ $.widget("ui.sortable", $.ui.mouse, {
769
774
 
770
775
  this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
771
776
  this.containers[innermostIndex].containerCache.over = 1;
772
- }
773
-
774
-
777
+ }
778
+
779
+
775
780
  },
776
781
 
777
782
  _createHelper: function(event) {
@@ -824,13 +829,13 @@ $.widget("ui.sortable", $.ui.mouse, {
824
829
  // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
825
830
  // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
826
831
  // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
827
- if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
832
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
828
833
  po.left += this.scrollParent.scrollLeft();
829
834
  po.top += this.scrollParent.scrollTop();
830
835
  }
831
836
 
832
837
  if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
833
- || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
838
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
834
839
  po = { top: 0, left: 0 };
835
840
 
836
841
  return {
@@ -898,20 +903,20 @@ $.widget("ui.sortable", $.ui.mouse, {
898
903
 
899
904
  if(!pos) pos = this.position;
900
905
  var mod = d == "absolute" ? 1 : -1;
901
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
906
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
902
907
 
903
908
  return {
904
909
  top: (
905
910
  pos.top // The absolute mouse position
906
911
  + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
907
912
  + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
908
- - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
913
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
909
914
  ),
910
915
  left: (
911
916
  pos.left // The absolute mouse position
912
917
  + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
913
918
  + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
914
- - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
919
+ - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
915
920
  )
916
921
  };
917
922
 
@@ -919,7 +924,7 @@ $.widget("ui.sortable", $.ui.mouse, {
919
924
 
920
925
  _generatePosition: function(event) {
921
926
 
922
- var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
927
+ var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
923
928
 
924
929
  // This is another very weird special case that only happens for relative elements:
925
930
  // 1. If the css position is relative
@@ -962,14 +967,14 @@ $.widget("ui.sortable", $.ui.mouse, {
962
967
  - this.offset.click.top // Click offset (relative to the element)
963
968
  - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
964
969
  - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
965
- + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
970
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
966
971
  ),
967
972
  left: (
968
973
  pageX // The absolute mouse position
969
974
  - this.offset.click.left // Click offset (relative to the element)
970
975
  - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
971
976
  - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
972
- + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
977
+ + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
973
978
  )
974
979
  };
975
980
 
@@ -985,11 +990,11 @@ $.widget("ui.sortable", $.ui.mouse, {
985
990
  // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
986
991
  // 4. this lets only the last addition to the timeout stack through
987
992
  this.counter = this.counter ? ++this.counter : 1;
988
- var self = this, counter = this.counter;
993
+ var counter = this.counter;
989
994
 
990
- window.setTimeout(function() {
991
- if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
992
- },0);
995
+ this._delay(function() {
996
+ if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
997
+ });
993
998
 
994
999
  },
995
1000
 
@@ -998,7 +1003,7 @@ $.widget("ui.sortable", $.ui.mouse, {
998
1003
  this.reverting = false;
999
1004
  // We delay all events that have to be triggered to after the point where the placeholder has been removed and
1000
1005
  // everything else normalized again
1001
- var delayedTriggers = [], self = this;
1006
+ var delayedTriggers = [];
1002
1007
 
1003
1008
  // We first have to update the dom position of the actual currentItem
1004
1009
  // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
@@ -1027,6 +1032,7 @@ $.widget("ui.sortable", $.ui.mouse, {
1027
1032
  }
1028
1033
  }
1029
1034
 
1035
+
1030
1036
  //Post events to containers
1031
1037
  for (var i = this.containers.length - 1; i >= 0; i--){
1032
1038
  if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
@@ -1076,23 +1082,19 @@ $.widget("ui.sortable", $.ui.mouse, {
1076
1082
  }
1077
1083
  },
1078
1084
 
1079
- _uiHash: function(inst) {
1080
- var self = inst || this;
1085
+ _uiHash: function(_inst) {
1086
+ var inst = _inst || this;
1081
1087
  return {
1082
- helper: self.helper,
1083
- placeholder: self.placeholder || $([]),
1084
- position: self.position,
1085
- originalPosition: self.originalPosition,
1086
- offset: self.positionAbs,
1087
- item: self.currentItem,
1088
- sender: inst ? inst.element : null
1088
+ helper: inst.helper,
1089
+ placeholder: inst.placeholder || $([]),
1090
+ position: inst.position,
1091
+ originalPosition: inst.originalPosition,
1092
+ offset: inst.positionAbs,
1093
+ item: inst.currentItem,
1094
+ sender: _inst ? _inst.element : null
1089
1095
  };
1090
1096
  }
1091
1097
 
1092
1098
  });
1093
1099
 
1094
- $.extend($.ui.sortable, {
1095
- version: "1.8.24"
1096
- });
1097
-
1098
1100
  })(jQuery);