jquerypp-rails 1.0.1.1.rc3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +28 -31
- data/lib/jquerypp/rails/version.rb +1 -1
- metadata +2 -25
- data/vendor/assets/javascripts/lib/jquery.animate.js +0 -326
- data/vendor/assets/javascripts/lib/jquery.compare.js +0 -75
- data/vendor/assets/javascripts/lib/jquery.cookie.js +0 -118
- data/vendor/assets/javascripts/lib/jquery.dimensions.js +0 -191
- data/vendor/assets/javascripts/lib/jquery.event.default.js +0 -115
- data/vendor/assets/javascripts/lib/jquery.event.destroyed.js +0 -23
- data/vendor/assets/javascripts/lib/jquery.event.drag.js +0 -727
- data/vendor/assets/javascripts/lib/jquery.event.drop.js +0 -457
- data/vendor/assets/javascripts/lib/jquery.event.fastfix.js +0 -95
- data/vendor/assets/javascripts/lib/jquery.event.hover.js +0 -266
- data/vendor/assets/javascripts/lib/jquery.event.key.js +0 -156
- data/vendor/assets/javascripts/lib/jquery.event.livehack.js +0 -174
- data/vendor/assets/javascripts/lib/jquery.event.pause.js +0 -92
- data/vendor/assets/javascripts/lib/jquery.event.resize.js +0 -47
- data/vendor/assets/javascripts/lib/jquery.event.swipe.js +0 -133
- data/vendor/assets/javascripts/lib/jquery.fills.js +0 -249
- data/vendor/assets/javascripts/lib/jquery.form_params.js +0 -167
- data/vendor/assets/javascripts/lib/jquery.lang.json.js +0 -196
- data/vendor/assets/javascripts/lib/jquery.lang.vector.js +0 -214
- data/vendor/assets/javascripts/lib/jquery.range.js +0 -861
- data/vendor/assets/javascripts/lib/jquery.selection.js +0 -232
- data/vendor/assets/javascripts/lib/jquery.styles.js +0 -103
- data/vendor/assets/javascripts/lib/jquery.within.js +0 -94
@@ -1,457 +0,0 @@
|
|
1
|
-
// Dependencies:
|
2
|
-
//
|
3
|
-
// - jquery.event.drop.js
|
4
|
-
// - jquery.compare.js
|
5
|
-
// - jquery.within.js
|
6
|
-
// - jquery.event.drag.js
|
7
|
-
// - jquery.event.livehack.js
|
8
|
-
// - jquery.lang.vector.js
|
9
|
-
|
10
|
-
(function($){
|
11
|
-
var event = $.event;
|
12
|
-
/**
|
13
|
-
* @add jQuery.event.special
|
14
|
-
*/
|
15
|
-
var eventNames = [
|
16
|
-
/**
|
17
|
-
* @attribute dropover
|
18
|
-
* @parent jQuery.event.drop
|
19
|
-
*
|
20
|
-
* `dropover` is triggered when a [jQuery.event.drag drag] is first moved onto this
|
21
|
-
* drop element.
|
22
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
23
|
-
* [jQuery.Drop] as the third parameter.
|
24
|
-
* This event can be used to highlight the element when a drag is moved over it:
|
25
|
-
*
|
26
|
-
* $('.droparea').on('dropover', function(ev, drop, drag) {
|
27
|
-
* $(this).addClass('highlight');
|
28
|
-
* });
|
29
|
-
*/
|
30
|
-
"dropover",
|
31
|
-
/**
|
32
|
-
* @attribute dropon
|
33
|
-
* @parent jQuery.event.drop
|
34
|
-
*
|
35
|
-
* `dropon` is triggered when a drag is dropped on a drop element.
|
36
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
37
|
-
* [jQuery.Drop] as the third parameter.
|
38
|
-
*
|
39
|
-
* $('.droparea').on('dropon', function(ev, drop, drag) {
|
40
|
-
* $(this).html('Dropped: ' + drag.element.text());
|
41
|
-
* });
|
42
|
-
*/
|
43
|
-
"dropon",
|
44
|
-
/**
|
45
|
-
* @attribute dropout
|
46
|
-
* @parent jQuery.event.drop
|
47
|
-
*
|
48
|
-
* `dropout` is called when a drag is moved out of this drop element.
|
49
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
50
|
-
* [jQuery.Drop] as the third parameter.
|
51
|
-
*
|
52
|
-
* $('.droparea').on('dropover', function(ev, drop, drag) {
|
53
|
-
* // Remove the drop element highlight
|
54
|
-
* $(this).removeClass('highlight');
|
55
|
-
* });
|
56
|
-
*/
|
57
|
-
"dropout",
|
58
|
-
/**
|
59
|
-
* @attribute dropinit
|
60
|
-
* @parent jQuery.event.drop
|
61
|
-
*
|
62
|
-
* `dropinit` is called when a drag motion starts and the drop elements are initialized.
|
63
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
64
|
-
* [jQuery.Drop] as the third parameter.
|
65
|
-
* Calling [jQuery.Drop.prototype.cancel drop.cancel()] prevents the element from
|
66
|
-
* being dropped on:
|
67
|
-
*
|
68
|
-
* $('.droparea').on('dropover', function(ev, drop, drag) {
|
69
|
-
* if(drag.element.hasClass('not-me')) {
|
70
|
-
* drop.cancel();
|
71
|
-
* }
|
72
|
-
* });
|
73
|
-
*/
|
74
|
-
"dropinit",
|
75
|
-
/**
|
76
|
-
* @attribute dropmove
|
77
|
-
* @parent jQuery.event.drop
|
78
|
-
*
|
79
|
-
* `dropmove` is triggered repeatedly when a drag is moved over a drop
|
80
|
-
* (similar to a mousemove).
|
81
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
82
|
-
* [jQuery.Drop] as the third parameter.
|
83
|
-
*
|
84
|
-
* $('.droparea').on('dropmove', function(ev, drop, drag) {
|
85
|
-
* $(this).html(drag.location.x() + '/' + drag.location.y());
|
86
|
-
* });
|
87
|
-
*/
|
88
|
-
"dropmove",
|
89
|
-
/**
|
90
|
-
* @attribute dropend
|
91
|
-
* @parent jQuery.event.drop
|
92
|
-
*
|
93
|
-
* `dropend` is called when the drag motion is done for this drop element.
|
94
|
-
* The event handler gets an instance of [jQuery.Drag] passed as the second and a
|
95
|
-
* [jQuery.Drop] as the third parameter.
|
96
|
-
*
|
97
|
-
*
|
98
|
-
* $('.droparea').on('dropend', function(ev, drop, drag) {
|
99
|
-
* // Remove the drop element highlight
|
100
|
-
* $(this).removeClass('highlight');
|
101
|
-
* });
|
102
|
-
*/
|
103
|
-
"dropend"];
|
104
|
-
|
105
|
-
/**
|
106
|
-
* @class jQuery.Drop
|
107
|
-
* @parent jQuery.event.drop
|
108
|
-
* @plugin jquery/event/drop
|
109
|
-
* @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/event/drop/drop.js
|
110
|
-
* @test jquery/event/drag/qunit.html
|
111
|
-
*
|
112
|
-
* The `jQuery.Drop` constructor is never called directly but an instance is passed to the
|
113
|
-
* to the `dropinit`, `dropover`, `dropmove`, `dropon`, and `dropend` event handlers as the
|
114
|
-
* third argument (the second will be the [jQuery.Drag]):
|
115
|
-
*
|
116
|
-
* $('#dropper').on('dropover', function(el, drop, drag) {
|
117
|
-
* // drop -> $.Drop
|
118
|
-
* // drag -> $.Drag
|
119
|
-
* });
|
120
|
-
*/
|
121
|
-
$.Drop = function(callbacks, element){
|
122
|
-
jQuery.extend(this,callbacks);
|
123
|
-
this.element = $(element);
|
124
|
-
}
|
125
|
-
// add the elements ...
|
126
|
-
$.each(eventNames, function(){
|
127
|
-
event.special[this] = {
|
128
|
-
add: function( handleObj ) {
|
129
|
-
//add this element to the compiles list
|
130
|
-
var el = $(this), current = (el.data("dropEventCount") || 0);
|
131
|
-
el.data("dropEventCount", current+1 )
|
132
|
-
if(current==0){
|
133
|
-
$.Drop.addElement(this);
|
134
|
-
}
|
135
|
-
},
|
136
|
-
remove: function() {
|
137
|
-
var el = $(this), current = (el.data("dropEventCount") || 0);
|
138
|
-
el.data("dropEventCount", current-1 )
|
139
|
-
if(current<=1){
|
140
|
-
$.Drop.removeElement(this);
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
$.extend($.Drop,{
|
147
|
-
/**
|
148
|
-
* @static
|
149
|
-
*/
|
150
|
-
lowerName: "drop",
|
151
|
-
_rootElements: [], //elements that are listening for drops
|
152
|
-
_elements: $(), //elements that can be dropped on
|
153
|
-
last_active: [],
|
154
|
-
endName: "dropon",
|
155
|
-
// adds an element as a 'root' element
|
156
|
-
// this element might have events that we need to respond to
|
157
|
-
addElement: function( el ) {
|
158
|
-
// check other elements
|
159
|
-
for(var i =0; i < this._rootElements.length ; i++ ){
|
160
|
-
if(el ==this._rootElements[i]) return;
|
161
|
-
}
|
162
|
-
this._rootElements.push(el);
|
163
|
-
},
|
164
|
-
removeElement: function( el ) {
|
165
|
-
for(var i =0; i < this._rootElements.length ; i++ ){
|
166
|
-
if(el == this._rootElements[i]){
|
167
|
-
this._rootElements.splice(i,1)
|
168
|
-
return;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
},
|
172
|
-
/**
|
173
|
-
* @hide
|
174
|
-
* For a list of affected drops, sorts them by which is deepest in the DOM first.
|
175
|
-
*/
|
176
|
-
sortByDeepestChild: function( a, b ) {
|
177
|
-
// Use jQuery.compare to compare two elements
|
178
|
-
var compare = a.element.compare(b.element);
|
179
|
-
if(compare & 16 || compare & 4) return 1;
|
180
|
-
if(compare & 8 || compare & 2) return -1;
|
181
|
-
return 0;
|
182
|
-
},
|
183
|
-
/**
|
184
|
-
* @hide
|
185
|
-
* Tests if a drop is within the point.
|
186
|
-
*/
|
187
|
-
isAffected: function( point, moveable, responder ) {
|
188
|
-
return ((responder.element != moveable.element) && (responder.element.within(point[0], point[1], responder._cache).length == 1));
|
189
|
-
},
|
190
|
-
/**
|
191
|
-
* @hide
|
192
|
-
* Calls dropout and sets last active to null
|
193
|
-
* @param {Object} drop
|
194
|
-
* @param {Object} drag
|
195
|
-
* @param {Object} event
|
196
|
-
*/
|
197
|
-
deactivate: function( responder, mover, event ) {
|
198
|
-
mover.out(event, responder)
|
199
|
-
responder.callHandlers(this.lowerName+'out',responder.element[0], event, mover)
|
200
|
-
},
|
201
|
-
/**
|
202
|
-
* @hide
|
203
|
-
* Calls dropover
|
204
|
-
* @param {Object} drop
|
205
|
-
* @param {Object} drag
|
206
|
-
* @param {Object} event
|
207
|
-
*/
|
208
|
-
activate: function( responder, mover, event ) { //this is where we should call over
|
209
|
-
mover.over(event, responder)
|
210
|
-
responder.callHandlers(this.lowerName+'over',responder.element[0], event, mover);
|
211
|
-
},
|
212
|
-
move: function( responder, mover, event ) {
|
213
|
-
responder.callHandlers(this.lowerName+'move',responder.element[0], event, mover)
|
214
|
-
},
|
215
|
-
/**
|
216
|
-
* `$.Drop.compile()` gets all elements that are droppable and adds them to a list.
|
217
|
-
*
|
218
|
-
* This should be called if and when new drops are added to the page
|
219
|
-
* during the motion of a single drag.
|
220
|
-
*
|
221
|
-
* This is called by default when a drag motion starts.
|
222
|
-
*
|
223
|
-
* ## Use
|
224
|
-
*
|
225
|
-
* After adding an element or drop, call compile.
|
226
|
-
*
|
227
|
-
* $("#midpoint").bind("dropover",function(){
|
228
|
-
* // when a drop hovers over midpoint,
|
229
|
-
* // make drop a drop.
|
230
|
-
* $("#drop").bind("dropover", function(){
|
231
|
-
*
|
232
|
-
* });
|
233
|
-
* $.Drop.compile();
|
234
|
-
* });
|
235
|
-
*/
|
236
|
-
compile: function( event, drag ) {
|
237
|
-
// if we called compile w/o a current drag
|
238
|
-
if(!this.dragging && !drag){
|
239
|
-
return;
|
240
|
-
}else if(!this.dragging){
|
241
|
-
this.dragging = drag;
|
242
|
-
this.last_active = [];
|
243
|
-
}
|
244
|
-
var el,
|
245
|
-
drops,
|
246
|
-
selector,
|
247
|
-
dropResponders,
|
248
|
-
newEls = [],
|
249
|
-
dragging = this.dragging;
|
250
|
-
|
251
|
-
// go to each root element and look for drop elements
|
252
|
-
for(var i=0; i < this._rootElements.length; i++){ //for each element
|
253
|
-
el = this._rootElements[i]
|
254
|
-
|
255
|
-
// gets something like {"": ["dropinit"], ".foo" : ["dropover","dropmove"] }
|
256
|
-
var drops = $.event.findBySelector(el, eventNames)
|
257
|
-
|
258
|
-
// get drop elements by selector
|
259
|
-
for(selector in drops){
|
260
|
-
dropResponders = selector ? jQuery(selector, el) : [el];
|
261
|
-
|
262
|
-
// for each drop element
|
263
|
-
for(var e= 0; e < dropResponders.length; e++){
|
264
|
-
|
265
|
-
// add the callbacks to the element's Data
|
266
|
-
// there already might be data, so we merge it
|
267
|
-
if( this.addCallbacks(dropResponders[e], drops[selector], dragging) ){
|
268
|
-
newEls.push(dropResponders[e])
|
269
|
-
};
|
270
|
-
}
|
271
|
-
}
|
272
|
-
}
|
273
|
-
// once all callbacks are added, call init on everything ...
|
274
|
-
this.add(newEls, event, dragging)
|
275
|
-
},
|
276
|
-
|
277
|
-
// adds the drag callbacks object to the element or merges other callbacks ...
|
278
|
-
// returns true or false if the element is new ...
|
279
|
-
// onlyNew lets only new elements add themselves
|
280
|
-
addCallbacks : function(el, callbacks, onlyNew){
|
281
|
-
var origData = $.data(el,"_dropData");
|
282
|
-
if(!origData){
|
283
|
-
$.data(el,"_dropData", new $.Drop(callbacks, el));
|
284
|
-
return true;
|
285
|
-
}else if(!onlyNew){
|
286
|
-
var origCbs = origData;
|
287
|
-
// merge data
|
288
|
-
for(var eventName in callbacks){
|
289
|
-
origCbs[eventName] = origCbs[eventName] ?
|
290
|
-
origCbs[eventName].concat(callbacks[eventName]) :
|
291
|
-
callbacks[eventName];
|
292
|
-
}
|
293
|
-
return false;
|
294
|
-
}
|
295
|
-
},
|
296
|
-
// calls init on each element's drags.
|
297
|
-
// if its cancelled it's removed
|
298
|
-
// adds to the current elements ...
|
299
|
-
add: function( newEls, event, drag , dragging) {
|
300
|
-
var i = 0,
|
301
|
-
drop;
|
302
|
-
|
303
|
-
while(i < newEls.length){
|
304
|
-
drop = $.data(newEls[i],"_dropData");
|
305
|
-
drop.callHandlers(this.lowerName+'init', newEls[i], event, drag)
|
306
|
-
if(drop._canceled){
|
307
|
-
newEls.splice(i,1)
|
308
|
-
}else{
|
309
|
-
i++;
|
310
|
-
}
|
311
|
-
}
|
312
|
-
this._elements.push.apply(this._elements, newEls)
|
313
|
-
},
|
314
|
-
show: function( point, moveable, event ) {
|
315
|
-
var element = moveable.element;
|
316
|
-
if(!this._elements.length) return;
|
317
|
-
|
318
|
-
var respondable,
|
319
|
-
affected = [],
|
320
|
-
propagate = true,
|
321
|
-
i = 0,
|
322
|
-
j,
|
323
|
-
la,
|
324
|
-
toBeActivated,
|
325
|
-
aff,
|
326
|
-
oldLastActive = this.last_active,
|
327
|
-
responders = [],
|
328
|
-
self = this,
|
329
|
-
drag;
|
330
|
-
|
331
|
-
// what's still affected ... we can also move element out here
|
332
|
-
while( i < this._elements.length){
|
333
|
-
drag = $.data(this._elements[i],"_dropData");
|
334
|
-
|
335
|
-
if (!drag) {
|
336
|
-
this._elements.splice(i, 1)
|
337
|
-
}
|
338
|
-
else {
|
339
|
-
i++;
|
340
|
-
if (self.isAffected(point, moveable, drag)) {
|
341
|
-
affected.push(drag);
|
342
|
-
}
|
343
|
-
}
|
344
|
-
}
|
345
|
-
|
346
|
-
// we should only trigger on lowest children
|
347
|
-
affected.sort(this.sortByDeepestChild);
|
348
|
-
event.stopRespondPropagate = function(){
|
349
|
-
propagate = false;
|
350
|
-
}
|
351
|
-
|
352
|
-
toBeActivated = affected.slice();
|
353
|
-
|
354
|
-
// all these will be active
|
355
|
-
this.last_active = affected;
|
356
|
-
|
357
|
-
// deactivate everything in last_active that isn't active
|
358
|
-
for (j = 0; j < oldLastActive.length; j++) {
|
359
|
-
la = oldLastActive[j];
|
360
|
-
i = 0;
|
361
|
-
while((aff = toBeActivated[i])){
|
362
|
-
if(la == aff){
|
363
|
-
toBeActivated.splice(i,1);break;
|
364
|
-
}else{
|
365
|
-
i++;
|
366
|
-
}
|
367
|
-
}
|
368
|
-
if(!aff){
|
369
|
-
this.deactivate(la, moveable, event);
|
370
|
-
}
|
371
|
-
if(!propagate) return;
|
372
|
-
}
|
373
|
-
for(var i =0; i < toBeActivated.length; i++){
|
374
|
-
this.activate(toBeActivated[i], moveable, event);
|
375
|
-
if(!propagate) return;
|
376
|
-
}
|
377
|
-
|
378
|
-
// activate everything in affected that isn't in last_active
|
379
|
-
for (i = 0; i < affected.length; i++) {
|
380
|
-
this.move(affected[i], moveable, event);
|
381
|
-
|
382
|
-
if(!propagate) return;
|
383
|
-
}
|
384
|
-
},
|
385
|
-
end: function( event, moveable ) {
|
386
|
-
var responder, la,
|
387
|
-
endName = this.lowerName+'end',
|
388
|
-
dropData;
|
389
|
-
|
390
|
-
// call dropon
|
391
|
-
// go through the actives ... if you are over one, call dropped on it
|
392
|
-
for(var i = 0; i < this.last_active.length; i++){
|
393
|
-
la = this.last_active[i]
|
394
|
-
if( this.isAffected(event.vector(), moveable, la) && la[this.endName]){
|
395
|
-
la.callHandlers(this.endName, null, event, moveable);
|
396
|
-
}
|
397
|
-
}
|
398
|
-
// call dropend
|
399
|
-
for(var r =0; r<this._elements.length; r++){
|
400
|
-
dropData = $.data(this._elements[r],"_dropData");
|
401
|
-
dropData && dropData.callHandlers(endName, null, event, moveable);
|
402
|
-
}
|
403
|
-
|
404
|
-
this.clear();
|
405
|
-
},
|
406
|
-
/**
|
407
|
-
* Called after dragging has stopped.
|
408
|
-
* @hide
|
409
|
-
*/
|
410
|
-
clear: function() {
|
411
|
-
this._elements.each(function(){
|
412
|
-
// remove temporary drop data
|
413
|
-
$.removeData(this,"_dropData")
|
414
|
-
})
|
415
|
-
this._elements = $();
|
416
|
-
delete this.dragging;
|
417
|
-
}
|
418
|
-
})
|
419
|
-
$.Drag.responder = $.Drop;
|
420
|
-
|
421
|
-
$.extend($.Drop.prototype,{
|
422
|
-
/**
|
423
|
-
* @prototype
|
424
|
-
*/
|
425
|
-
callHandlers: function( method, el, ev, drag ) {
|
426
|
-
var length = this[method] ? this[method].length : 0
|
427
|
-
for(var i =0; i < length; i++){
|
428
|
-
this[method][i].call(el || this.element[0], ev, this, drag)
|
429
|
-
}
|
430
|
-
},
|
431
|
-
/**
|
432
|
-
* `drop.cache(value)` sets the drop to cache positions of draggable elements.
|
433
|
-
* This should be called on `dropinit`. For example:
|
434
|
-
*
|
435
|
-
* $('#dropable').on('dropinit', function( el, ev, drop ) {
|
436
|
-
* drop.cache();
|
437
|
-
* });
|
438
|
-
*
|
439
|
-
* @param {Boolean} [value=true] Whether to cache drop elements or not.
|
440
|
-
*/
|
441
|
-
cache: function( value ) {
|
442
|
-
this._cache = value != null ? value : true;
|
443
|
-
},
|
444
|
-
/**
|
445
|
-
* `drop.cancel()` prevents this drop from being dropped on.
|
446
|
-
*
|
447
|
-
* $('.droparea').on('dropover', function(ev, drop, drag) {
|
448
|
-
* if(drag.element.hasClass('not-me')) {
|
449
|
-
* drop.cancel();
|
450
|
-
* }
|
451
|
-
* });
|
452
|
-
*/
|
453
|
-
cancel: function() {
|
454
|
-
this._canceled = true;
|
455
|
-
}
|
456
|
-
} )
|
457
|
-
})(jQuery)
|