jquery-plugins-rails 0.1.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NWViYTAwMjM3NTEzODc1NmJhOTI3ZDg3YWZkZGEwOTJiMGEzZDE2Zg==
5
+ data.tar.gz: !binary |-
6
+ OTVkNDQ0NjI0NmFmNGRkZjZjMjM5ZGZjMDIzMmYzZWI0ZWEzMjU3OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZDJkNzM5OTI0ZWFjMzQzY2U3NzgxZTkxYTYxYjUxZWFjODhjOWExZjg0ZjU2
10
+ ZmNkYzE5NmQ3NzAyY2E2YTA0MTk1NGQyOTk2MzE2NGJhNjk3YTU2NWFjOTg3
11
+ MWJkM2Q4ZmVkZDk5NmNlZDA5YzFiODc4NDJhMDU4ZmVmMjZmZTQ=
12
+ data.tar.gz: !binary |-
13
+ OTg2NjVkODFlOTcyMjViYjUzYmI5ZTdlZDdlNzJhZDA4ZWU0N2U5MjU3MGYz
14
+ ZTVmNmUzZTEzOWJhZjZiYjA4NTcyNzEwZDZkNGY1MTQ2YzVjMTZhOGIxNDBl
15
+ ZWI1NDMzZjVmNmMxOGY5NmNmNzc3NTQ4N2U4MjM2NzhiZDEyNTY=
data/.gitignore ADDED
@@ -0,0 +1,49 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ #.DS_Store
31
+
32
+ # For TextMate
33
+ #*.tmproj
34
+ #tmtags
35
+
36
+ # For emacs:
37
+ #*~
38
+ #\#*
39
+ #.\#*
40
+
41
+ # For vim:
42
+ #*.swp
43
+
44
+ # For redcar:
45
+ #.redcar
46
+
47
+ # For rubinius:
48
+ #*.rbc
49
+ .idea/
data/Gemfile.lock CHANGED
@@ -1,62 +1,47 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jquery-plugins-rails (0.1.0)
4
+ jquery-plugins-rails (0.2)
5
5
  jquery-rails
6
- railties (~> 3.0)
6
+ railties (> 3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (3.2.1)
12
- activemodel (= 3.2.1)
13
- activesupport (= 3.2.1)
14
- builder (~> 3.0.0)
11
+ actionpack (4.0.1)
12
+ activesupport (= 4.0.1)
13
+ builder (~> 3.1.0)
15
14
  erubis (~> 2.7.0)
16
- journey (~> 1.0.1)
17
- rack (~> 1.4.0)
18
- rack-cache (~> 1.1)
19
- rack-test (~> 0.6.1)
20
- sprockets (~> 2.1.2)
21
- activemodel (3.2.1)
22
- activesupport (= 3.2.1)
23
- builder (~> 3.0.0)
24
- activesupport (3.2.1)
25
- i18n (~> 0.6)
26
- multi_json (~> 1.0)
27
- builder (3.0.0)
15
+ rack (~> 1.5.2)
16
+ rack-test (~> 0.6.2)
17
+ activesupport (4.0.1)
18
+ i18n (~> 0.6, >= 0.6.4)
19
+ minitest (~> 4.2)
20
+ multi_json (~> 1.3)
21
+ thread_safe (~> 0.1)
22
+ tzinfo (~> 0.3.37)
23
+ atomic (1.1.14)
24
+ builder (3.1.4)
28
25
  erubis (2.7.0)
29
- hike (1.2.1)
30
- i18n (0.6.0)
31
- journey (1.0.1)
32
- jquery-rails (2.0.0)
33
- railties (>= 3.2.0.beta, < 5.0)
34
- thor (~> 0.14)
35
- json (1.6.5)
36
- multi_json (1.0.4)
37
- rack (1.4.1)
38
- rack-cache (1.1)
39
- rack (>= 0.4)
40
- rack-ssl (1.3.2)
41
- rack
42
- rack-test (0.6.1)
26
+ i18n (0.6.5)
27
+ jquery-rails (3.0.4)
28
+ railties (>= 3.0, < 5.0)
29
+ thor (>= 0.14, < 2.0)
30
+ minitest (4.7.5)
31
+ multi_json (1.8.2)
32
+ rack (1.5.2)
33
+ rack-test (0.6.2)
43
34
  rack (>= 1.0)
44
- railties (3.2.1)
45
- actionpack (= 3.2.1)
46
- activesupport (= 3.2.1)
47
- rack-ssl (~> 1.3.2)
35
+ railties (4.0.1)
36
+ actionpack (= 4.0.1)
37
+ activesupport (= 4.0.1)
48
38
  rake (>= 0.8.7)
49
- rdoc (~> 3.4)
50
- thor (~> 0.14.6)
51
- rake (0.9.2.2)
52
- rdoc (3.12)
53
- json (~> 1.4)
54
- sprockets (2.1.2)
55
- hike (~> 1.2)
56
- rack (~> 1.0)
57
- tilt (~> 1.1, != 1.3.0)
58
- thor (0.14.6)
59
- tilt (1.3.3)
39
+ thor (>= 0.18.1, < 2.0)
40
+ rake (10.1.0)
41
+ thor (0.18.1)
42
+ thread_safe (0.1.3)
43
+ atomic
44
+ tzinfo (0.3.38)
60
45
 
61
46
  PLATFORMS
62
47
  ruby
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JqueryPlugins::Rails
2
2
 
3
- TODO: Write a gem description
3
+ This gem includes some jquery plugins so that they can be used with the rails asset pipeline.
4
4
 
5
5
  ## Installation
6
6
 
@@ -16,10 +16,6 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install jquery-plugins-rails
18
18
 
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
19
  ## Contributing
24
20
 
25
21
  1. Fork it
@@ -1,16 +1,15 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/jquery-plugins/rails/version', __FILE__)
3
2
 
4
3
  Gem::Specification.new do |gem|
5
4
  gem.name = "jquery-plugins-rails"
6
- gem.version = JqueryPlugins::Rails::VERSION
5
+ gem.version = "0.2"
7
6
  gem.authors = ["Benedikt Böhm"]
8
7
  gem.email = ["bb@xnull.de"]
9
8
  gem.description = %q{jQuery plugins for Rails 3.x asset pipeline}
10
9
  gem.summary = %q{jQuery plugins for Rails 3.x asset pipeline}
11
10
  gem.homepage = "https://github.com/zenops/jquery-plugins-rails"
12
11
 
13
- gem.add_dependency "railties", "~> 3.0"
12
+ gem.add_dependency "railties", "> 3.0"
14
13
  gem.add_dependency "jquery-rails"
15
14
 
16
15
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -1,6 +1,5 @@
1
1
  module JqueryPlugins
2
2
  module Rails
3
3
  require 'jquery-plugins/rails/engine'
4
- require 'jquery-plugins/rails/version'
5
4
  end
6
5
  end
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * jquery.event.drag - v 2.0.0
2
+ * jquery.event.drag - v 2.2
3
3
  * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
4
4
  * Open Source MIT License - http://threedubmedia.com/code/license
5
5
  */
6
6
  // Created: 2008-06-04
7
- // Updated: 2010-06-07
8
- // REQUIRES: jquery 1.4.2+
7
+ // Updated: 2012-05-21
8
+ // REQUIRES: jquery 1.7.x
9
9
 
10
10
  ;(function( $ ){
11
11
 
@@ -44,8 +44,8 @@ drag = $special.drag = {
44
44
  // the key name for stored drag data
45
45
  datakey: "dragdata",
46
46
 
47
- // the namespace for internal live events
48
- livekey: "livedrag",
47
+ // prevent bubbling for better performance
48
+ noBubble: true,
49
49
 
50
50
  // count bound related events
51
51
  add: function( obj ){
@@ -55,11 +55,6 @@ drag = $special.drag = {
55
55
  opts = obj.data || {};
56
56
  // count another realted event
57
57
  data.related += 1;
58
- // bind the live "draginit" delegator
59
- if ( !data.live && obj.selector ){
60
- data.live = true;
61
- $event.add( this, "draginit."+ drag.livekey, drag.delegate );
62
- }
63
58
  // extend data options bound with this event
64
59
  // don't iterate "opts" in case it is a node
65
60
  $.each( drag.defaults, function( key, def ){
@@ -83,7 +78,7 @@ drag = $special.drag = {
83
78
  // store the interaction data
84
79
  $.data( this, drag.datakey, data );
85
80
  // bind the mousedown event, which starts drag interactions
86
- $event.add( this, "mousedown", drag.init, data );
81
+ $event.add( this, "touchstart mousedown", drag.init, data );
87
82
  // prevent image dragging in IE...
88
83
  if ( this.attachEvent )
89
84
  this.attachEvent("ondragstart", drag.dontstart );
@@ -91,15 +86,14 @@ drag = $special.drag = {
91
86
 
92
87
  // destroy configured interaction
93
88
  teardown: function(){
89
+ var data = $.data( this, drag.datakey ) || {};
94
90
  // check for related events
95
- if ( $.data( this, drag.datakey ).related )
91
+ if ( data.related )
96
92
  return;
97
93
  // remove the stored data
98
94
  $.removeData( this, drag.datakey );
99
95
  // remove the mousedown event
100
- $event.remove( this, "mousedown", drag.init );
101
- // remove the "live" delegation
102
- $event.remove( this, "draginit", drag.delegate );
96
+ $event.remove( this, "touchstart mousedown", drag.init );
103
97
  // enable text selection
104
98
  drag.textselect( true );
105
99
  // un-prevent image dragging in IE...
@@ -108,11 +102,14 @@ drag = $special.drag = {
108
102
  },
109
103
 
110
104
  // initialize the interaction
111
- init: function( event ){
105
+ init: function( event ){
106
+ // sorry, only one touch at a time
107
+ if ( drag.touched )
108
+ return;
112
109
  // the drag/drop interaction data
113
110
  var dd = event.data, results;
114
111
  // check the which directive
115
- if ( dd.which > 0 && event.which != dd.which )
112
+ if ( event.which != 0 && dd.which > 0 && event.which != dd.which )
116
113
  return;
117
114
  // check for suppressed selector
118
115
  if ( $( event.target ).is( dd.not ) )
@@ -120,8 +117,10 @@ drag = $special.drag = {
120
117
  // check for handle selector
121
118
  if ( dd.handle && !$( event.target ).closest( dd.handle, event.currentTarget ).length )
122
119
  return;
123
- // store/reset some initial attributes
120
+
121
+ drag.touched = event.type == 'touchstart' ? this : null;
124
122
  dd.propagates = 1;
123
+ dd.mousedown = this;
125
124
  dd.interactions = [ drag.interaction( this, dd ) ];
126
125
  dd.target = event.target;
127
126
  dd.pageX = event.pageX;
@@ -149,27 +148,36 @@ drag = $special.drag = {
149
148
  // disable text selection
150
149
  drag.textselect( false );
151
150
  // bind additional events...
152
- $event.add( document, "mousemove mouseup", drag.handler, dd );
153
- // helps prevent text selection
154
- return false;
151
+ if ( drag.touched )
152
+ $event.add( drag.touched, "touchmove touchend", drag.handler, dd );
153
+ else
154
+ $event.add( document, "mousemove mouseup", drag.handler, dd );
155
+ // helps prevent text selection or scrolling
156
+ if ( !drag.touched || dd.live )
157
+ return false;
155
158
  },
159
+
156
160
  // returns an interaction object
157
161
  interaction: function( elem, dd ){
162
+ var offset = $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 };
158
163
  return {
159
164
  drag: elem,
160
165
  callback: new drag.callback(),
161
166
  droppable: [],
162
- offset: $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 }
167
+ offset: offset
163
168
  };
164
169
  },
170
+
165
171
  // handle drag-releatd DOM events
166
172
  handler: function( event ){
167
173
  // read the data before hijacking anything
168
- var dd = event.data;
174
+ var dd = event.data;
169
175
  // handle various events
170
176
  switch ( event.type ){
171
177
  // mousemove, check distance, start dragging
172
- case !dd.dragging && 'mousemove':
178
+ case !dd.dragging && 'touchmove':
179
+ event.preventDefault();
180
+ case !dd.dragging && 'mousemove':
173
181
  // drag tolerance, x² + y² = distance²
174
182
  if ( Math.pow( event.pageX-dd.pageX, 2 ) + Math.pow( event.pageY-dd.pageY, 2 ) < Math.pow( dd.distance, 2 ) )
175
183
  break; // distance tolerance not reached
@@ -178,78 +186,49 @@ drag = $special.drag = {
178
186
  if ( dd.propagates ) // "dragstart" not rejected
179
187
  dd.dragging = true; // activate interaction
180
188
  // mousemove, dragging
181
- case 'mousemove':
189
+ case 'touchmove':
190
+ event.preventDefault();
191
+ case 'mousemove':
182
192
  if ( dd.dragging ){
183
193
  // trigger "drag"
184
194
  drag.hijack( event, "drag", dd );
185
195
  if ( dd.propagates ){
186
196
  // manage drop events
187
197
  if ( dd.drop !== false && $special.drop )
188
- $special.drop.handler( event, dd ); // "dropstart", "dropend"
198
+ $special.drop.handler( event, dd ); // "dropstart", "dropend"
189
199
  break; // "drag" not rejected, stop
190
200
  }
191
201
  event.type = "mouseup"; // helps "drop" handler behave
192
202
  }
193
203
  // mouseup, stop dragging
204
+ case 'touchend':
194
205
  case 'mouseup':
195
- $event.remove( document, "mousemove mouseup", drag.handler ); // remove page events
206
+ default:
207
+ if ( drag.touched )
208
+ $event.remove( drag.touched, "touchmove touchend", drag.handler ); // remove touch events
209
+ else
210
+ $event.remove( document, "mousemove mouseup", drag.handler ); // remove page events
196
211
  if ( dd.dragging ){
197
- if ( dd.drop !== false && $special.drop )
212
+ if ( dd.drop !== false && $special.drop )
198
213
  $special.drop.handler( event, dd ); // "drop"
199
214
  drag.hijack( event, "dragend", dd ); // trigger "dragend"
200
- }
215
+ }
201
216
  drag.textselect( true ); // enable text selection
202
-
203
217
  // if suppressing click events...
204
- if ( dd.click === false && dd.dragging ){
205
- jQuery.event.triggered = true;
206
- setTimeout(function(){
207
- jQuery.event.triggered = false;
208
- }, 20 );
209
- dd.dragging = false; // deactivate element
210
- }
218
+ if ( dd.click === false && dd.dragging )
219
+ $.data( dd.mousedown, "suppress.click", new Date().getTime() + 5 );
220
+ dd.dragging = drag.touched = false; // deactivate element
211
221
  break;
212
222
  }
213
223
  },
214
-
215
- // identify potential delegate elements
216
- delegate: function( event ){
217
- // local refs
218
- var elems = [], target,
219
- // element event structure
220
- events = $.data( this, "events" ) || {};
221
- // query live events
222
- $.each( events.live || [], function( i, obj ){
223
- // no event type matches
224
- if ( obj.preType.indexOf("drag") !== 0 )
225
- return;
226
- // locate the element to delegate
227
- target = $( event.target ).closest( obj.selector, event.currentTarget )[0];
228
- // no element found
229
- if ( !target )
230
- return;
231
- // add an event handler
232
- $event.add( target, obj.origType+'.'+drag.livekey, obj.origHandler, obj.data );
233
- // remember new elements
234
- if ( $.inArray( target, elems ) < 0 )
235
- elems.push( target );
236
- });
237
- // if there are no elements, break
238
- if ( !elems.length )
239
- return false;
240
- // return the matched results, and clenup when complete
241
- return $( elems ).bind("dragend."+ drag.livekey, function(){
242
- $event.remove( this, "."+ drag.livekey ); // cleanup delegation
243
- });
244
- },
245
-
224
+
246
225
  // re-use event object for custom events
247
226
  hijack: function( event, type, dd, x, elem ){
248
227
  // not configured
249
228
  if ( !dd )
250
229
  return;
251
230
  // remember the original event and type
252
- var orig = { event:event.originalEvent, type: event.type },
231
+ var orig = { event:event.originalEvent, type:event.type },
253
232
  // is the event drag related or drog related?
254
233
  mode = type.indexOf("drop") ? "drag" : "drop",
255
234
  // iteration vars
@@ -274,8 +253,10 @@ drag = $special.drag = {
274
253
  $( elem || ia[ mode ] || dd.droppable ).each(function( p, subject ){
275
254
  // identify drag or drop targets individually
276
255
  callback.target = subject;
256
+ // force propagtion of the custom event
257
+ event.isPropagationStopped = function(){ return false; };
277
258
  // handle the event
278
- result = subject ? $event.handle.call( subject, event, callback ) : null;
259
+ result = subject ? $event.dispatch.call( subject, event, callback ) : null;
279
260
  // stop the drag interaction for this element
280
261
  if ( result === false ){
281
262
  if ( mode == "drag" ){
@@ -333,8 +314,8 @@ drag = $special.drag = {
333
314
  obj.originalX = ia.offset.left;
334
315
  obj.originalY = ia.offset.top;
335
316
  // adjusted element position
336
- obj.offsetX = event.pageX - ( dd.pageX - obj.originalX );
337
- obj.offsetY = event.pageY - ( dd.pageY - obj.originalY );
317
+ obj.offsetX = obj.originalX + obj.deltaX;
318
+ obj.offsetY = obj.originalY + obj.deltaY;
338
319
  // assign the drop targets information
339
320
  obj.drop = drag.flatten( ( ia.drop || [] ).slice() );
340
321
  obj.available = drag.flatten( ( ia.droppable || [] ).slice() );
@@ -358,8 +339,9 @@ drag = $special.drag = {
358
339
  // toggles text selection attributes ON (true) or OFF (false)
359
340
  textselect: function( bool ){
360
341
  $( document )[ bool ? "unbind" : "bind" ]("selectstart", drag.dontstart )
361
- .attr("unselectable", bool ? "off" : "on" )
362
342
  .css("MozUserSelect", bool ? "" : "none" );
343
+ // .attr("unselectable", bool ? "off" : "on" )
344
+ document.unselectable = bool ? "off" : "on";
363
345
  },
364
346
 
365
347
  // suppress "selectstart" and "ondragstart" events
@@ -382,6 +364,38 @@ drag.callback.prototype = {
382
364
  }
383
365
  };
384
366
 
367
+ // patch $.event.$dispatch to allow suppressing clicks
368
+ var $dispatch = $event.dispatch;
369
+ $event.dispatch = function( event ){
370
+ if ( $.data( this, "suppress."+ event.type ) - new Date().getTime() > 0 ){
371
+ $.removeData( this, "suppress."+ event.type );
372
+ return;
373
+ }
374
+ return $dispatch.apply( this, arguments );
375
+ };
376
+
377
+ // event fix hooks for touch events...
378
+ var touchHooks =
379
+ $event.fixHooks.touchstart =
380
+ $event.fixHooks.touchmove =
381
+ $event.fixHooks.touchend =
382
+ $event.fixHooks.touchcancel = {
383
+ props: "clientX clientY pageX pageY screenX screenY".split( " " ),
384
+ filter: function( event, orig ) {
385
+ if ( orig ){
386
+ var touched = ( orig.touches && orig.touches[0] )
387
+ || ( orig.changedTouches && orig.changedTouches[0] )
388
+ || null;
389
+ // iOS webkit: touchstart, touchmove, touchend
390
+ if ( touched )
391
+ $.each( touchHooks.props, function( i, prop ){
392
+ event[ prop ] = touched[ prop ];
393
+ });
394
+ }
395
+ return event;
396
+ }
397
+ };
398
+
385
399
  // share the same special event configuration with related events...
386
400
  $special.draginit = $special.dragstart = $special.dragend = drag;
387
401
 
@@ -1,15 +1,15 @@
1
1
  /*!
2
- * jquery.event.drop - v 2.0.0
2
+ * jquery.event.drop - v 2.2
3
3
  * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
4
4
  * Open Source MIT License - http://threedubmedia.com/code/license
5
5
  */
6
6
  // Created: 2008-06-04
7
- // Updated: 2010-06-08
8
- // REQUIRES: jquery 1.4.2+, jquery.event.drag 2+
7
+ // Updated: 2012-05-21
8
+ // REQUIRES: jquery 1.7.x, event.drag 2.2
9
9
 
10
10
  ;(function($){ // secure $ jQuery alias
11
11
 
12
- // Events: drop, dropinit, dropstart, dropend
12
+ // Events: drop, dropstart, dropend
13
13
 
14
14
  // add the jquery instance method
15
15
  $.fn.drop = function( str, arg, opts ){
@@ -55,9 +55,9 @@ drop = $.event.special.drop = {
55
55
 
56
56
  // the key name for stored drop data
57
57
  datakey: "dropdata",
58
-
59
- // the namespace for internal live events
60
- livekey: "livedrop",
58
+
59
+ // prevent bubbling for better performance
60
+ noBubble: true,
61
61
 
62
62
  // count bound related events
63
63
  add: function( obj ){
@@ -65,11 +65,6 @@ drop = $.event.special.drop = {
65
65
  var data = $.data( this, drop.datakey );
66
66
  // count another realted event
67
67
  data.related += 1;
68
- // bind the live "dropinit" delegator
69
- if ( !data.live && obj.selector ){
70
- data.live = true;
71
- $event.add( this, "dropinit."+ drop.livekey, drop.delegate );
72
- }
73
68
  },
74
69
 
75
70
  // forget unbound related events
@@ -98,13 +93,12 @@ drop = $.event.special.drop = {
98
93
 
99
94
  // destroy the configure interaction
100
95
  teardown: function(){
96
+ var data = $.data( this, drop.datakey ) || {};
101
97
  // check for related events
102
- if ( $.data( this, drop.datakey ).related )
98
+ if ( data.related )
103
99
  return;
104
100
  // remove the stored data
105
101
  $.removeData( this, drop.datakey );
106
- // remove the "live" delegation
107
- $event.remove( this, "dropinit", drop.delegate );
108
102
  // reference the targeted element
109
103
  var element = this;
110
104
  // remove from the internal cache
@@ -124,6 +118,7 @@ drop = $.event.special.drop = {
124
118
  switch ( event.type ){
125
119
  // draginit, from $.event.special.drag
126
120
  case 'mousedown': // DROPINIT >>
121
+ case 'touchstart': // DROPINIT >>
127
122
  // collect and assign the drop targets
128
123
  $targets = $( drop.targets );
129
124
  if ( typeof dd.drop == "string" )
@@ -137,15 +132,12 @@ drop = $.event.special.drop = {
137
132
  });
138
133
  // set available target elements
139
134
  dd.droppable = $targets;
140
- // hold any live elements
141
- drop.delegates = [];
142
135
  // activate drop targets for the initial element being dragged
143
136
  $special.drag.hijack( event, "dropinit", dd );
144
- // flatten all the live elements
145
- drop.delegates = $.unique( $special.drag.flatten( drop.delegates ) );
146
137
  break;
147
138
  // drag, from $.event.special.drag
148
139
  case 'mousemove': // TOLERATE >>
140
+ case 'touchmove': // TOLERATE >>
149
141
  drop.event = event; // store the mousemove event
150
142
  if ( !drop.timer )
151
143
  // monitor drop targets
@@ -153,48 +145,17 @@ drop = $.event.special.drop = {
153
145
  break;
154
146
  // dragend, from $.event.special.drag
155
147
  case 'mouseup': // DROP >> DROPEND >>
148
+ case 'touchend': // DROP >> DROPEND >>
156
149
  drop.timer = clearTimeout( drop.timer ); // delete timer
157
150
  if ( dd.propagates ){
158
151
  $special.drag.hijack( event, "drop", dd );
159
152
  $special.drag.hijack( event, "dropend", dd );
160
- // cleanout live events...
161
- $.each( drop.delegates || [], function(){
162
- $event.remove( this, '.'+ drop.livekey );
163
- });
164
153
  }
165
154
  break;
155
+
166
156
  }
167
157
  },
168
-
169
- // identify potential delegate elements
170
- delegate: function( event ){
171
- // local refs
172
- var elems = [], $targets,
173
- // element event structure
174
- events = $.data( this, "events" ) || {};
175
- // query live events
176
- $.each( events.live || [], function( i, obj ){
177
- // no event type matches
178
- if ( obj.preType.indexOf("drop") !== 0 )
179
- return;
180
- // locate the elements to delegate
181
- $targets = $( event.currentTarget ).find( obj.selector );
182
- // no element found
183
- if ( !$targets.length )
184
- return;
185
- // take each target...
186
- $targets.each(function(){
187
- // add an event handler
188
- $event.add( this, obj.origType +'.'+ drop.livekey, obj.origHandler, obj.data );
189
- // remember new elements
190
- if ( $.inArray( this, elems ) < 0 )
191
- elems.push( this );
192
- });
193
- });
194
- drop.delegates.push( elems );
195
- return elems.length ? $( elems ) : false;
196
- },
197
-
158
+
198
159
  // returns the location positions of an element
199
160
  locate: function( elem, index ){
200
161
  var data = $.data( elem, drop.datakey ),
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-plugins-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: '0.2'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Benedikt Böhm
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-06 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
- requirement: &4698280 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ~>
17
+ - - ! '>'
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *4698280
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>'
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: jquery-rails
27
- requirement: &4697840 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *4697840
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
36
41
  description: jQuery plugins for Rails 3.x asset pipeline
37
42
  email:
38
43
  - bb@xnull.de
@@ -40,7 +45,7 @@ executables: []
40
45
  extensions: []
41
46
  extra_rdoc_files: []
42
47
  files:
43
- - .rvmrc
48
+ - .gitignore
44
49
  - Gemfile
45
50
  - Gemfile.lock
46
51
  - LICENSE
@@ -50,7 +55,6 @@ files:
50
55
  - lib/jquery-plugins-rails.rb
51
56
  - lib/jquery-plugins/rails.rb
52
57
  - lib/jquery-plugins/rails/engine.rb
53
- - lib/jquery-plugins/rails/version.rb
54
58
  - vendor/assets/javascripts/jquery/event/drag.js
55
59
  - vendor/assets/javascripts/jquery/event/drop.js
56
60
  - vendor/assets/javascripts/jquery/fuzzymatch.js
@@ -58,26 +62,25 @@ files:
58
62
  - vendor/assets/javascripts/jquery/metadata.js
59
63
  homepage: https://github.com/zenops/jquery-plugins-rails
60
64
  licenses: []
65
+ metadata: {}
61
66
  post_install_message:
62
67
  rdoc_options: []
63
68
  require_paths:
64
69
  - lib
65
70
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
71
  requirements:
68
72
  - - ! '>='
69
73
  - !ruby/object:Gem::Version
70
74
  version: '0'
71
75
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
76
  requirements:
74
77
  - - ! '>='
75
78
  - !ruby/object:Gem::Version
76
79
  version: '0'
77
80
  requirements: []
78
81
  rubyforge_project:
79
- rubygems_version: 1.8.17
82
+ rubygems_version: 2.0.6
80
83
  signing_key:
81
- specification_version: 3
84
+ specification_version: 4
82
85
  summary: jQuery plugins for Rails 3.x asset pipeline
83
86
  test_files: []
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create ruby-1.9.3-p125@jquery-plugins-rails
@@ -1,5 +0,0 @@
1
- module JqueryPlugins
2
- module Rails
3
- VERSION = "0.1.1"
4
- end
5
- end