jquery-ui-rails 0.4.0 → 0.4.1

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 (137) hide show
  1. data/.gitignore +0 -1
  2. data/History.md +6 -0
  3. data/README.md +1 -0
  4. data/Rakefile +13 -2
  5. data/lib/jquery/ui/rails/version.rb +1 -1
  6. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  7. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  8. data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  9. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  10. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  11. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  12. data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  13. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  14. data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  15. data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  16. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  17. data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  18. data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  19. data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
  20. data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
  21. data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
  22. data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
  23. data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
  24. data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
  25. data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
  26. data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
  27. data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
  28. data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
  29. data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
  30. data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
  31. data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
  32. data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
  33. data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
  34. data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
  35. data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
  36. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
  37. data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
  38. data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
  39. data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
  40. data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
  41. data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
  42. data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
  43. data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
  44. data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
  45. data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
  46. data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
  47. data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
  48. data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
  49. data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
  50. data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
  51. data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
  52. data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
  53. data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
  54. data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
  55. data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
  56. data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
  57. data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
  58. data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
  59. data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
  60. data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
  61. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
  62. data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
  63. data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
  64. data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
  65. data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
  66. data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
  67. data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
  68. data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
  69. data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
  70. data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
  71. data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
  72. data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
  73. data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
  74. data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
  75. data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
  76. data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
  77. data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
  78. data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
  79. data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
  80. data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
  81. data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
  82. data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
  83. data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
  84. data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
  85. data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
  86. data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
  87. data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
  88. data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
  89. data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
  90. data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
  91. data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
  92. data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
  93. data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
  94. data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
  95. data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
  96. data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
  97. data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
  98. data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
  99. data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
  100. data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
  101. data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
  102. data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
  103. data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
  104. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
  105. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
  106. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
  107. data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
  108. data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
  109. data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
  110. data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
  111. data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
  112. data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
  113. data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
  114. data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
  115. data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
  116. data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
  117. data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
  118. data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
  119. data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
  120. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
  121. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
  122. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
  123. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
  124. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
  125. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
  126. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
  127. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
  128. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
  129. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
  130. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
  131. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
  132. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
  133. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
  134. metadata +111 -113
  135. data/jquery-ui/GPL-LICENSE.txt +0 -278
  136. data/jquery-ui/MIT-LICENSE.txt +0 -25
  137. data/jquery-ui/package.json +0 -36
@@ -0,0 +1,835 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+ //= require jquery.ui.mouse
4
+
5
+ /*!
6
+ * jQuery UI Draggable 1.8.20
7
+ *
8
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ * http://jquery.org/license
11
+ *
12
+ * http://docs.jquery.com/UI/Draggables
13
+ *
14
+ * Depends:
15
+ * jquery.ui.core.js
16
+ * jquery.ui.mouse.js
17
+ * jquery.ui.widget.js
18
+ */
19
+ (function( $, undefined ) {
20
+
21
+ $.widget("ui.draggable", $.ui.mouse, {
22
+ widgetEventPrefix: "drag",
23
+ options: {
24
+ addClasses: true,
25
+ appendTo: "parent",
26
+ axis: false,
27
+ connectToSortable: false,
28
+ containment: false,
29
+ cursor: "auto",
30
+ cursorAt: false,
31
+ grid: false,
32
+ handle: false,
33
+ helper: "original",
34
+ iframeFix: false,
35
+ opacity: false,
36
+ refreshPositions: false,
37
+ revert: false,
38
+ revertDuration: 500,
39
+ scope: "default",
40
+ scroll: true,
41
+ scrollSensitivity: 20,
42
+ scrollSpeed: 20,
43
+ snap: false,
44
+ snapMode: "both",
45
+ snapTolerance: 20,
46
+ stack: false,
47
+ zIndex: false
48
+ },
49
+ _create: function() {
50
+
51
+ if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
52
+ this.element[0].style.position = 'relative';
53
+
54
+ (this.options.addClasses && this.element.addClass("ui-draggable"));
55
+ (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
56
+
57
+ this._mouseInit();
58
+
59
+ },
60
+
61
+ destroy: function() {
62
+ if(!this.element.data('draggable')) return;
63
+ this.element
64
+ .removeData("draggable")
65
+ .unbind(".draggable")
66
+ .removeClass("ui-draggable"
67
+ + " ui-draggable-dragging"
68
+ + " ui-draggable-disabled");
69
+ this._mouseDestroy();
70
+
71
+ return this;
72
+ },
73
+
74
+ _mouseCapture: function(event) {
75
+
76
+ var o = this.options;
77
+
78
+ // among others, prevent a drag on a resizable-handle
79
+ if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
80
+ return false;
81
+
82
+ //Quit if we're not on a valid handle
83
+ this.handle = this._getHandle(event);
84
+ if (!this.handle)
85
+ return false;
86
+
87
+ if ( o.iframeFix ) {
88
+ $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
89
+ $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
90
+ .css({
91
+ width: this.offsetWidth+"px", height: this.offsetHeight+"px",
92
+ position: "absolute", opacity: "0.001", zIndex: 1000
93
+ })
94
+ .css($(this).offset())
95
+ .appendTo("body");
96
+ });
97
+ }
98
+
99
+ return true;
100
+
101
+ },
102
+
103
+ _mouseStart: function(event) {
104
+
105
+ var o = this.options;
106
+
107
+ //Create and append the visible helper
108
+ this.helper = this._createHelper(event);
109
+
110
+ //Cache the helper size
111
+ this._cacheHelperProportions();
112
+
113
+ //If ddmanager is used for droppables, set the global draggable
114
+ if($.ui.ddmanager)
115
+ $.ui.ddmanager.current = this;
116
+
117
+ /*
118
+ * - Position generation -
119
+ * This block generates everything position related - it's the core of draggables.
120
+ */
121
+
122
+ //Cache the margins of the original element
123
+ this._cacheMargins();
124
+
125
+ //Store the helper's css position
126
+ this.cssPosition = this.helper.css("position");
127
+ this.scrollParent = this.helper.scrollParent();
128
+
129
+ //The element's absolute position on the page minus margins
130
+ this.offset = this.positionAbs = this.element.offset();
131
+ this.offset = {
132
+ top: this.offset.top - this.margins.top,
133
+ left: this.offset.left - this.margins.left
134
+ };
135
+
136
+ $.extend(this.offset, {
137
+ click: { //Where the click happened, relative to the element
138
+ left: event.pageX - this.offset.left,
139
+ top: event.pageY - this.offset.top
140
+ },
141
+ parent: this._getParentOffset(),
142
+ relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
143
+ });
144
+
145
+ //Generate the original position
146
+ this.originalPosition = this.position = this._generatePosition(event);
147
+ this.originalPageX = event.pageX;
148
+ this.originalPageY = event.pageY;
149
+
150
+ //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
151
+ (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
152
+
153
+ //Set a containment if given in the options
154
+ if(o.containment)
155
+ this._setContainment();
156
+
157
+ //Trigger event + callbacks
158
+ if(this._trigger("start", event) === false) {
159
+ this._clear();
160
+ return false;
161
+ }
162
+
163
+ //Recache the helper size
164
+ this._cacheHelperProportions();
165
+
166
+ //Prepare the droppable offsets
167
+ if ($.ui.ddmanager && !o.dropBehaviour)
168
+ $.ui.ddmanager.prepareOffsets(this, event);
169
+
170
+ this.helper.addClass("ui-draggable-dragging");
171
+ this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
172
+
173
+ //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
174
+ if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
175
+
176
+ return true;
177
+ },
178
+
179
+ _mouseDrag: function(event, noPropagation) {
180
+
181
+ //Compute the helpers position
182
+ this.position = this._generatePosition(event);
183
+ this.positionAbs = this._convertPositionTo("absolute");
184
+
185
+ //Call plugins and callbacks and use the resulting position if something is returned
186
+ if (!noPropagation) {
187
+ var ui = this._uiHash();
188
+ if(this._trigger('drag', event, ui) === false) {
189
+ this._mouseUp({});
190
+ return false;
191
+ }
192
+ this.position = ui.position;
193
+ }
194
+
195
+ if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
196
+ if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
197
+ if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
198
+
199
+ return false;
200
+ },
201
+
202
+ _mouseStop: function(event) {
203
+
204
+ //If we are using droppables, inform the manager about the drop
205
+ var dropped = false;
206
+ if ($.ui.ddmanager && !this.options.dropBehaviour)
207
+ dropped = $.ui.ddmanager.drop(this, event);
208
+
209
+ //if a drop comes from outside (a sortable)
210
+ if(this.dropped) {
211
+ dropped = this.dropped;
212
+ this.dropped = false;
213
+ }
214
+
215
+ //if the original element is no longer in the DOM don't bother to continue (see #8269)
216
+ var element = this.element[0], elementInDom = false;
217
+ while ( element && (element = element.parentNode) ) {
218
+ if (element == document ) {
219
+ elementInDom = true;
220
+ }
221
+ }
222
+ if ( !elementInDom && this.options.helper === "original" )
223
+ return false;
224
+
225
+ if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
226
+ var self = this;
227
+ $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
228
+ if(self._trigger("stop", event) !== false) {
229
+ self._clear();
230
+ }
231
+ });
232
+ } else {
233
+ if(this._trigger("stop", event) !== false) {
234
+ this._clear();
235
+ }
236
+ }
237
+
238
+ return false;
239
+ },
240
+
241
+ _mouseUp: function(event) {
242
+ if (this.options.iframeFix === true) {
243
+ $("div.ui-draggable-iframeFix").each(function() {
244
+ this.parentNode.removeChild(this);
245
+ }); //Remove frame helpers
246
+ }
247
+
248
+ //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
249
+ if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
250
+
251
+ return $.ui.mouse.prototype._mouseUp.call(this, event);
252
+ },
253
+
254
+ cancel: function() {
255
+
256
+ if(this.helper.is(".ui-draggable-dragging")) {
257
+ this._mouseUp({});
258
+ } else {
259
+ this._clear();
260
+ }
261
+
262
+ return this;
263
+
264
+ },
265
+
266
+ _getHandle: function(event) {
267
+
268
+ var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
269
+ $(this.options.handle, this.element)
270
+ .find("*")
271
+ .andSelf()
272
+ .each(function() {
273
+ if(this == event.target) handle = true;
274
+ });
275
+
276
+ return handle;
277
+
278
+ },
279
+
280
+ _createHelper: function(event) {
281
+
282
+ var o = this.options;
283
+ var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
284
+
285
+ if(!helper.parents('body').length)
286
+ helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
287
+
288
+ if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
289
+ helper.css("position", "absolute");
290
+
291
+ return helper;
292
+
293
+ },
294
+
295
+ _adjustOffsetFromHelper: function(obj) {
296
+ if (typeof obj == 'string') {
297
+ obj = obj.split(' ');
298
+ }
299
+ if ($.isArray(obj)) {
300
+ obj = {left: +obj[0], top: +obj[1] || 0};
301
+ }
302
+ if ('left' in obj) {
303
+ this.offset.click.left = obj.left + this.margins.left;
304
+ }
305
+ if ('right' in obj) {
306
+ this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
307
+ }
308
+ if ('top' in obj) {
309
+ this.offset.click.top = obj.top + this.margins.top;
310
+ }
311
+ if ('bottom' in obj) {
312
+ this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
313
+ }
314
+ },
315
+
316
+ _getParentOffset: function() {
317
+
318
+ //Get the offsetParent and cache its position
319
+ this.offsetParent = this.helper.offsetParent();
320
+ var po = this.offsetParent.offset();
321
+
322
+ // This is a special case where we need to modify a offset calculated on start, since the following happened:
323
+ // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
324
+ // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
325
+ // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
326
+ if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
327
+ po.left += this.scrollParent.scrollLeft();
328
+ po.top += this.scrollParent.scrollTop();
329
+ }
330
+
331
+ if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
332
+ || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
333
+ po = { top: 0, left: 0 };
334
+
335
+ return {
336
+ top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
337
+ left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
338
+ };
339
+
340
+ },
341
+
342
+ _getRelativeOffset: function() {
343
+
344
+ if(this.cssPosition == "relative") {
345
+ var p = this.element.position();
346
+ return {
347
+ top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
348
+ left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
349
+ };
350
+ } else {
351
+ return { top: 0, left: 0 };
352
+ }
353
+
354
+ },
355
+
356
+ _cacheMargins: function() {
357
+ this.margins = {
358
+ left: (parseInt(this.element.css("marginLeft"),10) || 0),
359
+ top: (parseInt(this.element.css("marginTop"),10) || 0),
360
+ right: (parseInt(this.element.css("marginRight"),10) || 0),
361
+ bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
362
+ };
363
+ },
364
+
365
+ _cacheHelperProportions: function() {
366
+ this.helperProportions = {
367
+ width: this.helper.outerWidth(),
368
+ height: this.helper.outerHeight()
369
+ };
370
+ },
371
+
372
+ _setContainment: function() {
373
+
374
+ var o = this.options;
375
+ if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
376
+ if(o.containment == 'document' || o.containment == 'window') this.containment = [
377
+ o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
378
+ o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
379
+ (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
380
+ (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
381
+ ];
382
+
383
+ if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
384
+ var c = $(o.containment);
385
+ var ce = c[0]; if(!ce) return;
386
+ var co = c.offset();
387
+ var over = ($(ce).css("overflow") != 'hidden');
388
+
389
+ this.containment = [
390
+ (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
391
+ (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
392
+ (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
393
+ (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
394
+ ];
395
+ this.relative_container = c;
396
+
397
+ } else if(o.containment.constructor == Array) {
398
+ this.containment = o.containment;
399
+ }
400
+
401
+ },
402
+
403
+ _convertPositionTo: function(d, pos) {
404
+
405
+ if(!pos) pos = this.position;
406
+ var mod = d == "absolute" ? 1 : -1;
407
+ 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);
408
+
409
+ return {
410
+ top: (
411
+ pos.top // The absolute mouse position
412
+ + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
413
+ + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
414
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
415
+ ),
416
+ left: (
417
+ pos.left // The absolute mouse position
418
+ + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
419
+ + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
420
+ - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
421
+ )
422
+ };
423
+
424
+ },
425
+
426
+ _generatePosition: function(event) {
427
+
428
+ 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);
429
+ var pageX = event.pageX;
430
+ var pageY = event.pageY;
431
+
432
+ /*
433
+ * - Position constraining -
434
+ * Constrain the position to a mix of grid, containment.
435
+ */
436
+
437
+ if(this.originalPosition) { //If we are not dragging yet, we won't check for options
438
+ var containment;
439
+ if(this.containment) {
440
+ if (this.relative_container){
441
+ var co = this.relative_container.offset();
442
+ containment = [ this.containment[0] + co.left,
443
+ this.containment[1] + co.top,
444
+ this.containment[2] + co.left,
445
+ this.containment[3] + co.top ];
446
+ }
447
+ else {
448
+ containment = this.containment;
449
+ }
450
+
451
+ if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
452
+ if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
453
+ if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
454
+ if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
455
+ }
456
+
457
+ if(o.grid) {
458
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
459
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
460
+ pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
461
+
462
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
463
+ pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
464
+ }
465
+
466
+ }
467
+
468
+ return {
469
+ top: (
470
+ pageY // The absolute mouse position
471
+ - this.offset.click.top // Click offset (relative to the element)
472
+ - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
473
+ - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
474
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
475
+ ),
476
+ left: (
477
+ pageX // The absolute mouse position
478
+ - this.offset.click.left // Click offset (relative to the element)
479
+ - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
480
+ - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
481
+ + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
482
+ )
483
+ };
484
+
485
+ },
486
+
487
+ _clear: function() {
488
+ this.helper.removeClass("ui-draggable-dragging");
489
+ if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
490
+ //if($.ui.ddmanager) $.ui.ddmanager.current = null;
491
+ this.helper = null;
492
+ this.cancelHelperRemoval = false;
493
+ },
494
+
495
+ // From now on bulk stuff - mainly helpers
496
+
497
+ _trigger: function(type, event, ui) {
498
+ ui = ui || this._uiHash();
499
+ $.ui.plugin.call(this, type, [event, ui]);
500
+ if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
501
+ return $.Widget.prototype._trigger.call(this, type, event, ui);
502
+ },
503
+
504
+ plugins: {},
505
+
506
+ _uiHash: function(event) {
507
+ return {
508
+ helper: this.helper,
509
+ position: this.position,
510
+ originalPosition: this.originalPosition,
511
+ offset: this.positionAbs
512
+ };
513
+ }
514
+
515
+ });
516
+
517
+ $.extend($.ui.draggable, {
518
+ version: "1.8.20"
519
+ });
520
+
521
+ $.ui.plugin.add("draggable", "connectToSortable", {
522
+ start: function(event, ui) {
523
+
524
+ var inst = $(this).data("draggable"), o = inst.options,
525
+ uiSortable = $.extend({}, ui, { item: inst.element });
526
+ inst.sortables = [];
527
+ $(o.connectToSortable).each(function() {
528
+ var sortable = $.data(this, 'sortable');
529
+ if (sortable && !sortable.options.disabled) {
530
+ inst.sortables.push({
531
+ instance: sortable,
532
+ shouldRevert: sortable.options.revert
533
+ });
534
+ sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
535
+ sortable._trigger("activate", event, uiSortable);
536
+ }
537
+ });
538
+
539
+ },
540
+ stop: function(event, ui) {
541
+
542
+ //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
543
+ var inst = $(this).data("draggable"),
544
+ uiSortable = $.extend({}, ui, { item: inst.element });
545
+
546
+ $.each(inst.sortables, function() {
547
+ if(this.instance.isOver) {
548
+
549
+ this.instance.isOver = 0;
550
+
551
+ inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
552
+ this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
553
+
554
+ //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
555
+ if(this.shouldRevert) this.instance.options.revert = true;
556
+
557
+ //Trigger the stop of the sortable
558
+ this.instance._mouseStop(event);
559
+
560
+ this.instance.options.helper = this.instance.options._helper;
561
+
562
+ //If the helper has been the original item, restore properties in the sortable
563
+ if(inst.options.helper == 'original')
564
+ this.instance.currentItem.css({ top: 'auto', left: 'auto' });
565
+
566
+ } else {
567
+ this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
568
+ this.instance._trigger("deactivate", event, uiSortable);
569
+ }
570
+
571
+ });
572
+
573
+ },
574
+ drag: function(event, ui) {
575
+
576
+ var inst = $(this).data("draggable"), self = this;
577
+
578
+ var checkPos = function(o) {
579
+ var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
580
+ var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
581
+ var itemHeight = o.height, itemWidth = o.width;
582
+ var itemTop = o.top, itemLeft = o.left;
583
+
584
+ return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
585
+ };
586
+
587
+ $.each(inst.sortables, function(i) {
588
+
589
+ //Copy over some variables to allow calling the sortable's native _intersectsWith
590
+ this.instance.positionAbs = inst.positionAbs;
591
+ this.instance.helperProportions = inst.helperProportions;
592
+ this.instance.offset.click = inst.offset.click;
593
+
594
+ if(this.instance._intersectsWith(this.instance.containerCache)) {
595
+
596
+ //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
597
+ if(!this.instance.isOver) {
598
+
599
+ this.instance.isOver = 1;
600
+ //Now we fake the start of dragging for the sortable instance,
601
+ //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
602
+ //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
603
+ this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
604
+ this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
605
+ this.instance.options.helper = function() { return ui.helper[0]; };
606
+
607
+ event.target = this.instance.currentItem[0];
608
+ this.instance._mouseCapture(event, true);
609
+ this.instance._mouseStart(event, true, true);
610
+
611
+ //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
612
+ this.instance.offset.click.top = inst.offset.click.top;
613
+ this.instance.offset.click.left = inst.offset.click.left;
614
+ this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
615
+ this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
616
+
617
+ inst._trigger("toSortable", event);
618
+ inst.dropped = this.instance.element; //draggable revert needs that
619
+ //hack so receive/update callbacks work (mostly)
620
+ inst.currentItem = inst.element;
621
+ this.instance.fromOutside = inst;
622
+
623
+ }
624
+
625
+ //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
626
+ if(this.instance.currentItem) this.instance._mouseDrag(event);
627
+
628
+ } else {
629
+
630
+ //If it doesn't intersect with the sortable, and it intersected before,
631
+ //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
632
+ if(this.instance.isOver) {
633
+
634
+ this.instance.isOver = 0;
635
+ this.instance.cancelHelperRemoval = true;
636
+
637
+ //Prevent reverting on this forced stop
638
+ this.instance.options.revert = false;
639
+
640
+ // The out event needs to be triggered independently
641
+ this.instance._trigger('out', event, this.instance._uiHash(this.instance));
642
+
643
+ this.instance._mouseStop(event, true);
644
+ this.instance.options.helper = this.instance.options._helper;
645
+
646
+ //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
647
+ this.instance.currentItem.remove();
648
+ if(this.instance.placeholder) this.instance.placeholder.remove();
649
+
650
+ inst._trigger("fromSortable", event);
651
+ inst.dropped = false; //draggable revert needs that
652
+ }
653
+
654
+ };
655
+
656
+ });
657
+
658
+ }
659
+ });
660
+
661
+ $.ui.plugin.add("draggable", "cursor", {
662
+ start: function(event, ui) {
663
+ var t = $('body'), o = $(this).data('draggable').options;
664
+ if (t.css("cursor")) o._cursor = t.css("cursor");
665
+ t.css("cursor", o.cursor);
666
+ },
667
+ stop: function(event, ui) {
668
+ var o = $(this).data('draggable').options;
669
+ if (o._cursor) $('body').css("cursor", o._cursor);
670
+ }
671
+ });
672
+
673
+ $.ui.plugin.add("draggable", "opacity", {
674
+ start: function(event, ui) {
675
+ var t = $(ui.helper), o = $(this).data('draggable').options;
676
+ if(t.css("opacity")) o._opacity = t.css("opacity");
677
+ t.css('opacity', o.opacity);
678
+ },
679
+ stop: function(event, ui) {
680
+ var o = $(this).data('draggable').options;
681
+ if(o._opacity) $(ui.helper).css('opacity', o._opacity);
682
+ }
683
+ });
684
+
685
+ $.ui.plugin.add("draggable", "scroll", {
686
+ start: function(event, ui) {
687
+ var i = $(this).data("draggable");
688
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
689
+ },
690
+ drag: function(event, ui) {
691
+
692
+ var i = $(this).data("draggable"), o = i.options, scrolled = false;
693
+
694
+ if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
695
+
696
+ if(!o.axis || o.axis != 'x') {
697
+ if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
698
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
699
+ else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
700
+ i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
701
+ }
702
+
703
+ if(!o.axis || o.axis != 'y') {
704
+ if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
705
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
706
+ else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
707
+ i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
708
+ }
709
+
710
+ } else {
711
+
712
+ if(!o.axis || o.axis != 'x') {
713
+ if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
714
+ scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
715
+ else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
716
+ scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
717
+ }
718
+
719
+ if(!o.axis || o.axis != 'y') {
720
+ if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
721
+ scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
722
+ else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
723
+ scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
724
+ }
725
+
726
+ }
727
+
728
+ if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
729
+ $.ui.ddmanager.prepareOffsets(i, event);
730
+
731
+ }
732
+ });
733
+
734
+ $.ui.plugin.add("draggable", "snap", {
735
+ start: function(event, ui) {
736
+
737
+ var i = $(this).data("draggable"), o = i.options;
738
+ i.snapElements = [];
739
+
740
+ $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
741
+ var $t = $(this); var $o = $t.offset();
742
+ if(this != i.element[0]) i.snapElements.push({
743
+ item: this,
744
+ width: $t.outerWidth(), height: $t.outerHeight(),
745
+ top: $o.top, left: $o.left
746
+ });
747
+ });
748
+
749
+ },
750
+ drag: function(event, ui) {
751
+
752
+ var inst = $(this).data("draggable"), o = inst.options;
753
+ var d = o.snapTolerance;
754
+
755
+ var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
756
+ y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
757
+
758
+ for (var i = inst.snapElements.length - 1; i >= 0; i--){
759
+
760
+ var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
761
+ t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
762
+
763
+ //Yes, I know, this is insane ;)
764
+ if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
765
+ if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
766
+ inst.snapElements[i].snapping = false;
767
+ continue;
768
+ }
769
+
770
+ if(o.snapMode != 'inner') {
771
+ var ts = Math.abs(t - y2) <= d;
772
+ var bs = Math.abs(b - y1) <= d;
773
+ var ls = Math.abs(l - x2) <= d;
774
+ var rs = Math.abs(r - x1) <= d;
775
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
776
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
777
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
778
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
779
+ }
780
+
781
+ var first = (ts || bs || ls || rs);
782
+
783
+ if(o.snapMode != 'outer') {
784
+ var ts = Math.abs(t - y1) <= d;
785
+ var bs = Math.abs(b - y2) <= d;
786
+ var ls = Math.abs(l - x1) <= d;
787
+ var rs = Math.abs(r - x2) <= d;
788
+ if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
789
+ if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
790
+ if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
791
+ if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
792
+ }
793
+
794
+ if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
795
+ (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
796
+ inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
797
+
798
+ };
799
+
800
+ }
801
+ });
802
+
803
+ $.ui.plugin.add("draggable", "stack", {
804
+ start: function(event, ui) {
805
+
806
+ var o = $(this).data("draggable").options;
807
+
808
+ var group = $.makeArray($(o.stack)).sort(function(a,b) {
809
+ return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
810
+ });
811
+ if (!group.length) { return; }
812
+
813
+ var min = parseInt(group[0].style.zIndex) || 0;
814
+ $(group).each(function(i) {
815
+ this.style.zIndex = min + i;
816
+ });
817
+
818
+ this[0].style.zIndex = min + group.length;
819
+
820
+ }
821
+ });
822
+
823
+ $.ui.plugin.add("draggable", "zIndex", {
824
+ start: function(event, ui) {
825
+ var t = $(ui.helper), o = $(this).data("draggable").options;
826
+ if(t.css("zIndex")) o._zIndex = t.css("zIndex");
827
+ t.css('zIndex', o.zIndex);
828
+ },
829
+ stop: function(event, ui) {
830
+ var o = $(this).data("draggable").options;
831
+ if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
832
+ }
833
+ });
834
+
835
+ })(jQuery);