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.
- data/.gitignore +0 -1
- data/History.md +6 -0
- data/README.md +1 -0
- data/Rakefile +13 -2
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
- data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
- data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
- data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
- data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
- data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
- data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
- data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
- data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
- data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
- data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
- data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
- data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
- data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
- data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
- data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
- data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
- data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
- data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
- data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
- data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
- data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
- data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
- data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
- data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
- data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
- metadata +111 -113
- data/jquery-ui/GPL-LICENSE.txt +0 -278
- data/jquery-ui/MIT-LICENSE.txt +0 -25
- data/jquery-ui/package.json +0 -36
@@ -0,0 +1,301 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
//= require jquery.ui.mouse
|
4
|
+
//= require jquery.ui.draggable
|
5
|
+
|
6
|
+
/*!
|
7
|
+
* jQuery UI Droppable 1.8.20
|
8
|
+
*
|
9
|
+
* Copyright 2012, 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/Droppables
|
14
|
+
*
|
15
|
+
* Depends:
|
16
|
+
* jquery.ui.core.js
|
17
|
+
* jquery.ui.widget.js
|
18
|
+
* jquery.ui.mouse.js
|
19
|
+
* jquery.ui.draggable.js
|
20
|
+
*/
|
21
|
+
(function( $, undefined ) {
|
22
|
+
|
23
|
+
$.widget("ui.droppable", {
|
24
|
+
widgetEventPrefix: "drop",
|
25
|
+
options: {
|
26
|
+
accept: '*',
|
27
|
+
activeClass: false,
|
28
|
+
addClasses: true,
|
29
|
+
greedy: false,
|
30
|
+
hoverClass: false,
|
31
|
+
scope: 'default',
|
32
|
+
tolerance: 'intersect'
|
33
|
+
},
|
34
|
+
_create: function() {
|
35
|
+
|
36
|
+
var o = this.options, accept = o.accept;
|
37
|
+
this.isover = 0; this.isout = 1;
|
38
|
+
|
39
|
+
this.accept = $.isFunction(accept) ? accept : function(d) {
|
40
|
+
return d.is(accept);
|
41
|
+
};
|
42
|
+
|
43
|
+
//Store the droppable's proportions
|
44
|
+
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
45
|
+
|
46
|
+
// Add the reference and positions to the manager
|
47
|
+
$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
|
48
|
+
$.ui.ddmanager.droppables[o.scope].push(this);
|
49
|
+
|
50
|
+
(o.addClasses && this.element.addClass("ui-droppable"));
|
51
|
+
|
52
|
+
},
|
53
|
+
|
54
|
+
destroy: function() {
|
55
|
+
var drop = $.ui.ddmanager.droppables[this.options.scope];
|
56
|
+
for ( var i = 0; i < drop.length; i++ )
|
57
|
+
if ( drop[i] == this )
|
58
|
+
drop.splice(i, 1);
|
59
|
+
|
60
|
+
this.element
|
61
|
+
.removeClass("ui-droppable ui-droppable-disabled")
|
62
|
+
.removeData("droppable")
|
63
|
+
.unbind(".droppable");
|
64
|
+
|
65
|
+
return this;
|
66
|
+
},
|
67
|
+
|
68
|
+
_setOption: function(key, value) {
|
69
|
+
|
70
|
+
if(key == 'accept') {
|
71
|
+
this.accept = $.isFunction(value) ? value : function(d) {
|
72
|
+
return d.is(value);
|
73
|
+
};
|
74
|
+
}
|
75
|
+
$.Widget.prototype._setOption.apply(this, arguments);
|
76
|
+
},
|
77
|
+
|
78
|
+
_activate: function(event) {
|
79
|
+
var draggable = $.ui.ddmanager.current;
|
80
|
+
if(this.options.activeClass) this.element.addClass(this.options.activeClass);
|
81
|
+
(draggable && this._trigger('activate', event, this.ui(draggable)));
|
82
|
+
},
|
83
|
+
|
84
|
+
_deactivate: function(event) {
|
85
|
+
var draggable = $.ui.ddmanager.current;
|
86
|
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
87
|
+
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
|
88
|
+
},
|
89
|
+
|
90
|
+
_over: function(event) {
|
91
|
+
|
92
|
+
var draggable = $.ui.ddmanager.current;
|
93
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
94
|
+
|
95
|
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
96
|
+
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
|
97
|
+
this._trigger('over', event, this.ui(draggable));
|
98
|
+
}
|
99
|
+
|
100
|
+
},
|
101
|
+
|
102
|
+
_out: function(event) {
|
103
|
+
|
104
|
+
var draggable = $.ui.ddmanager.current;
|
105
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
106
|
+
|
107
|
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
108
|
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
109
|
+
this._trigger('out', event, this.ui(draggable));
|
110
|
+
}
|
111
|
+
|
112
|
+
},
|
113
|
+
|
114
|
+
_drop: function(event,custom) {
|
115
|
+
|
116
|
+
var draggable = custom || $.ui.ddmanager.current;
|
117
|
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
|
118
|
+
|
119
|
+
var childrenIntersection = false;
|
120
|
+
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
121
|
+
var inst = $.data(this, 'droppable');
|
122
|
+
if(
|
123
|
+
inst.options.greedy
|
124
|
+
&& !inst.options.disabled
|
125
|
+
&& inst.options.scope == draggable.options.scope
|
126
|
+
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
|
127
|
+
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
|
128
|
+
) { childrenIntersection = true; return false; }
|
129
|
+
});
|
130
|
+
if(childrenIntersection) return false;
|
131
|
+
|
132
|
+
if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
133
|
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
134
|
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
135
|
+
this._trigger('drop', event, this.ui(draggable));
|
136
|
+
return this.element;
|
137
|
+
}
|
138
|
+
|
139
|
+
return false;
|
140
|
+
|
141
|
+
},
|
142
|
+
|
143
|
+
ui: function(c) {
|
144
|
+
return {
|
145
|
+
draggable: (c.currentItem || c.element),
|
146
|
+
helper: c.helper,
|
147
|
+
position: c.position,
|
148
|
+
offset: c.positionAbs
|
149
|
+
};
|
150
|
+
}
|
151
|
+
|
152
|
+
});
|
153
|
+
|
154
|
+
$.extend($.ui.droppable, {
|
155
|
+
version: "1.8.20"
|
156
|
+
});
|
157
|
+
|
158
|
+
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
159
|
+
|
160
|
+
if (!droppable.offset) return false;
|
161
|
+
|
162
|
+
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
163
|
+
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
164
|
+
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
165
|
+
t = droppable.offset.top, b = t + droppable.proportions.height;
|
166
|
+
|
167
|
+
switch (toleranceMode) {
|
168
|
+
case 'fit':
|
169
|
+
return (l <= x1 && x2 <= r
|
170
|
+
&& t <= y1 && y2 <= b);
|
171
|
+
break;
|
172
|
+
case 'intersect':
|
173
|
+
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
|
174
|
+
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
|
175
|
+
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
|
176
|
+
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
|
177
|
+
break;
|
178
|
+
case 'pointer':
|
179
|
+
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
|
180
|
+
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
|
181
|
+
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
|
182
|
+
return isOver;
|
183
|
+
break;
|
184
|
+
case 'touch':
|
185
|
+
return (
|
186
|
+
(y1 >= t && y1 <= b) || // Top edge touching
|
187
|
+
(y2 >= t && y2 <= b) || // Bottom edge touching
|
188
|
+
(y1 < t && y2 > b) // Surrounded vertically
|
189
|
+
) && (
|
190
|
+
(x1 >= l && x1 <= r) || // Left edge touching
|
191
|
+
(x2 >= l && x2 <= r) || // Right edge touching
|
192
|
+
(x1 < l && x2 > r) // Surrounded horizontally
|
193
|
+
);
|
194
|
+
break;
|
195
|
+
default:
|
196
|
+
return false;
|
197
|
+
break;
|
198
|
+
}
|
199
|
+
|
200
|
+
};
|
201
|
+
|
202
|
+
/*
|
203
|
+
This manager tracks offsets of draggables and droppables
|
204
|
+
*/
|
205
|
+
$.ui.ddmanager = {
|
206
|
+
current: null,
|
207
|
+
droppables: { 'default': [] },
|
208
|
+
prepareOffsets: function(t, event) {
|
209
|
+
|
210
|
+
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
|
211
|
+
var type = event ? event.type : null; // workaround for #2317
|
212
|
+
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
213
|
+
|
214
|
+
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
215
|
+
|
216
|
+
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
217
|
+
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
218
|
+
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
219
|
+
|
220
|
+
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
|
221
|
+
|
222
|
+
m[i].offset = m[i].element.offset();
|
223
|
+
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
},
|
228
|
+
drop: function(draggable, event) {
|
229
|
+
|
230
|
+
var dropped = false;
|
231
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
232
|
+
|
233
|
+
if(!this.options) return;
|
234
|
+
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
235
|
+
dropped = this._drop.call(this, event) || dropped;
|
236
|
+
|
237
|
+
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
238
|
+
this.isout = 1; this.isover = 0;
|
239
|
+
this._deactivate.call(this, event);
|
240
|
+
}
|
241
|
+
|
242
|
+
});
|
243
|
+
return dropped;
|
244
|
+
|
245
|
+
},
|
246
|
+
dragStart: function( draggable, event ) {
|
247
|
+
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
|
248
|
+
draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
|
249
|
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
250
|
+
});
|
251
|
+
},
|
252
|
+
drag: function(draggable, event) {
|
253
|
+
|
254
|
+
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
|
255
|
+
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
|
256
|
+
|
257
|
+
//Run through all droppables and check their positions based on specific tolerance options
|
258
|
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
259
|
+
|
260
|
+
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
261
|
+
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
262
|
+
|
263
|
+
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
264
|
+
if(!c) return;
|
265
|
+
|
266
|
+
var parentInstance;
|
267
|
+
if (this.options.greedy) {
|
268
|
+
var parent = this.element.parents(':data(droppable):eq(0)');
|
269
|
+
if (parent.length) {
|
270
|
+
parentInstance = $.data(parent[0], 'droppable');
|
271
|
+
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
// we just moved into a greedy child
|
276
|
+
if (parentInstance && c == 'isover') {
|
277
|
+
parentInstance['isover'] = 0;
|
278
|
+
parentInstance['isout'] = 1;
|
279
|
+
parentInstance._out.call(parentInstance, event);
|
280
|
+
}
|
281
|
+
|
282
|
+
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
283
|
+
this[c == "isover" ? "_over" : "_out"].call(this, event);
|
284
|
+
|
285
|
+
// we just moved out of a greedy child
|
286
|
+
if (parentInstance && c == 'isout') {
|
287
|
+
parentInstance['isout'] = 0;
|
288
|
+
parentInstance['isover'] = 1;
|
289
|
+
parentInstance._over.call(parentInstance, event);
|
290
|
+
}
|
291
|
+
});
|
292
|
+
|
293
|
+
},
|
294
|
+
dragStop: function( draggable, event ) {
|
295
|
+
draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
|
296
|
+
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
|
297
|
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
298
|
+
}
|
299
|
+
};
|
300
|
+
|
301
|
+
})(jQuery);
|
@@ -0,0 +1,168 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
|
4
|
+
/*!
|
5
|
+
* jQuery UI Mouse 1.8.20
|
6
|
+
*
|
7
|
+
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
8
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
9
|
+
* http://jquery.org/license
|
10
|
+
*
|
11
|
+
* http://docs.jquery.com/UI/Mouse
|
12
|
+
*
|
13
|
+
* Depends:
|
14
|
+
* jquery.ui.widget.js
|
15
|
+
*/
|
16
|
+
(function( $, undefined ) {
|
17
|
+
|
18
|
+
var mouseHandled = false;
|
19
|
+
$( document ).mouseup( function( e ) {
|
20
|
+
mouseHandled = false;
|
21
|
+
});
|
22
|
+
|
23
|
+
$.widget("ui.mouse", {
|
24
|
+
options: {
|
25
|
+
cancel: ':input,option',
|
26
|
+
distance: 1,
|
27
|
+
delay: 0
|
28
|
+
},
|
29
|
+
_mouseInit: function() {
|
30
|
+
var self = this;
|
31
|
+
|
32
|
+
this.element
|
33
|
+
.bind('mousedown.'+this.widgetName, function(event) {
|
34
|
+
return self._mouseDown(event);
|
35
|
+
})
|
36
|
+
.bind('click.'+this.widgetName, function(event) {
|
37
|
+
if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
|
38
|
+
$.removeData(event.target, self.widgetName + '.preventClickEvent');
|
39
|
+
event.stopImmediatePropagation();
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
this.started = false;
|
45
|
+
},
|
46
|
+
|
47
|
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
48
|
+
// other instances of mouse
|
49
|
+
_mouseDestroy: function() {
|
50
|
+
this.element.unbind('.'+this.widgetName);
|
51
|
+
$(document)
|
52
|
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
53
|
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
54
|
+
},
|
55
|
+
|
56
|
+
_mouseDown: function(event) {
|
57
|
+
// don't let more than one widget handle mouseStart
|
58
|
+
if( mouseHandled ) { return };
|
59
|
+
|
60
|
+
// we may have missed mouseup (out of window)
|
61
|
+
(this._mouseStarted && this._mouseUp(event));
|
62
|
+
|
63
|
+
this._mouseDownEvent = event;
|
64
|
+
|
65
|
+
var self = this,
|
66
|
+
btnIsLeft = (event.which == 1),
|
67
|
+
// event.target.nodeName works around a bug in IE 8 with
|
68
|
+
// disabled inputs (#7620)
|
69
|
+
elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
|
70
|
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
|
74
|
+
this.mouseDelayMet = !this.options.delay;
|
75
|
+
if (!this.mouseDelayMet) {
|
76
|
+
this._mouseDelayTimer = setTimeout(function() {
|
77
|
+
self.mouseDelayMet = true;
|
78
|
+
}, this.options.delay);
|
79
|
+
}
|
80
|
+
|
81
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
82
|
+
this._mouseStarted = (this._mouseStart(event) !== false);
|
83
|
+
if (!this._mouseStarted) {
|
84
|
+
event.preventDefault();
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
// Click event may never have fired (Gecko & Opera)
|
90
|
+
if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
|
91
|
+
$.removeData(event.target, this.widgetName + '.preventClickEvent');
|
92
|
+
}
|
93
|
+
|
94
|
+
// these delegates are required to keep context
|
95
|
+
this._mouseMoveDelegate = function(event) {
|
96
|
+
return self._mouseMove(event);
|
97
|
+
};
|
98
|
+
this._mouseUpDelegate = function(event) {
|
99
|
+
return self._mouseUp(event);
|
100
|
+
};
|
101
|
+
$(document)
|
102
|
+
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
103
|
+
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
104
|
+
|
105
|
+
event.preventDefault();
|
106
|
+
|
107
|
+
mouseHandled = true;
|
108
|
+
return true;
|
109
|
+
},
|
110
|
+
|
111
|
+
_mouseMove: function(event) {
|
112
|
+
// IE mouseup check - mouseup happened when mouse was out of window
|
113
|
+
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
|
114
|
+
return this._mouseUp(event);
|
115
|
+
}
|
116
|
+
|
117
|
+
if (this._mouseStarted) {
|
118
|
+
this._mouseDrag(event);
|
119
|
+
return event.preventDefault();
|
120
|
+
}
|
121
|
+
|
122
|
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
123
|
+
this._mouseStarted =
|
124
|
+
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
125
|
+
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
126
|
+
}
|
127
|
+
|
128
|
+
return !this._mouseStarted;
|
129
|
+
},
|
130
|
+
|
131
|
+
_mouseUp: function(event) {
|
132
|
+
$(document)
|
133
|
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
134
|
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
135
|
+
|
136
|
+
if (this._mouseStarted) {
|
137
|
+
this._mouseStarted = false;
|
138
|
+
|
139
|
+
if (event.target == this._mouseDownEvent.target) {
|
140
|
+
$.data(event.target, this.widgetName + '.preventClickEvent', true);
|
141
|
+
}
|
142
|
+
|
143
|
+
this._mouseStop(event);
|
144
|
+
}
|
145
|
+
|
146
|
+
return false;
|
147
|
+
},
|
148
|
+
|
149
|
+
_mouseDistanceMet: function(event) {
|
150
|
+
return (Math.max(
|
151
|
+
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
152
|
+
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
153
|
+
) >= this.options.distance
|
154
|
+
);
|
155
|
+
},
|
156
|
+
|
157
|
+
_mouseDelayMet: function(event) {
|
158
|
+
return this.mouseDelayMet;
|
159
|
+
},
|
160
|
+
|
161
|
+
// These are placeholder methods, to be overriden by extending plugin
|
162
|
+
_mouseStart: function(event) {},
|
163
|
+
_mouseDrag: function(event) {},
|
164
|
+
_mouseStop: function(event) {},
|
165
|
+
_mouseCapture: function(event) { return true; }
|
166
|
+
});
|
167
|
+
|
168
|
+
})(jQuery);
|