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