jquery-mousewheel-rails 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 091ff6904ab24e276d443180db638de29f0cef9f
4
- data.tar.gz: d558433c382650d87f1b875f8653d5872022a3ca
3
+ metadata.gz: 47b2139f152bffe38a309543a6941fb2655ccb47
4
+ data.tar.gz: f665cbc873d508b6cb81b508efc8557a8277dd8e
5
5
  SHA512:
6
- metadata.gz: 8881145db9b1e0d0be3efe492b28b3d9d2d7be7e37ad4951a71a6182450b4b36beba8076f26654899c825f9940c2b82fd797b509c24a41f5752accf66f980d65
7
- data.tar.gz: 25117fd4b49e9f9382b8f5dae69857972a4583c5913aeae5d95580cc6b2ba2370103f672d9e9d99e31ac3c5ee2eec709e4986c2baf120672929f5b1d0fc904eb
6
+ metadata.gz: b9c65127f445b50466267c0bc0aafcf41cbd7aebc20b68549799889a4811b0044ec930405e7bb6629bee1983b77a5bac77cb87a2e2c7c76fabebb6649097dd90
7
+ data.tar.gz: b2200b33b24031adf5586835432d971c57540213db6b17589beda5d1bc779ecee5ff726b9c8b98d9fe7d748784e71c1ecb2586f9f5081bb72001ee7f1f53862c
@@ -1,47 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jquery-mousewheel-rails (0.0.7)
4
+ jquery-mousewheel-rails (0.0.8)
5
5
  railties (>= 3.1)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionpack (4.0.0)
11
- activesupport (= 4.0.0)
12
- builder (~> 3.1.0)
13
- erubis (~> 2.7.0)
10
+ actionpack (4.1.0)
11
+ actionview (= 4.1.0)
12
+ activesupport (= 4.1.0)
14
13
  rack (~> 1.5.2)
15
14
  rack-test (~> 0.6.2)
16
- activesupport (4.0.0)
17
- i18n (~> 0.6, >= 0.6.4)
18
- minitest (~> 4.2)
19
- multi_json (~> 1.3)
15
+ actionview (4.1.0)
16
+ activesupport (= 4.1.0)
17
+ builder (~> 3.1)
18
+ erubis (~> 2.7.0)
19
+ activesupport (4.1.0)
20
+ i18n (~> 0.6, >= 0.6.9)
21
+ json (~> 1.7, >= 1.7.7)
22
+ minitest (~> 5.1)
20
23
  thread_safe (~> 0.1)
21
- tzinfo (~> 0.3.37)
22
- atomic (1.1.14)
23
- builder (3.1.4)
24
+ tzinfo (~> 1.1)
25
+ builder (3.2.2)
24
26
  erubis (2.7.0)
25
- i18n (0.6.5)
26
- jquery-rails (3.0.4)
27
+ i18n (0.6.9)
28
+ jquery-rails (3.1.0)
27
29
  railties (>= 3.0, < 5.0)
28
30
  thor (>= 0.14, < 2.0)
29
- minitest (4.7.5)
30
- multi_json (1.8.2)
31
+ json (1.8.1)
32
+ minitest (5.3.3)
31
33
  rack (1.5.2)
32
34
  rack-test (0.6.2)
33
35
  rack (>= 1.0)
34
- railties (4.0.0)
35
- actionpack (= 4.0.0)
36
- activesupport (= 4.0.0)
36
+ railties (4.1.0)
37
+ actionpack (= 4.1.0)
38
+ activesupport (= 4.1.0)
37
39
  rake (>= 0.8.7)
38
40
  thor (>= 0.18.1, < 2.0)
39
- rake (10.1.0)
40
- sqlite3 (1.3.8)
41
- thor (0.18.1)
42
- thread_safe (0.1.3)
43
- atomic
44
- tzinfo (0.3.38)
41
+ rake (10.3.1)
42
+ sqlite3 (1.3.9)
43
+ thor (0.19.1)
44
+ thread_safe (0.3.3)
45
+ tzinfo (1.1.0)
46
+ thread_safe (~> 0.1)
45
47
 
46
48
  PLATFORMS
47
49
  ruby
@@ -1,3 +1,3 @@
1
1
  module JqueryMousewheelRails
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -1,201 +1,220 @@
1
1
  /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2
2
  * Licensed under the MIT License (LICENSE.txt).
3
3
  *
4
- * Version: 3.1.9
4
+ * Version: 3.1.11
5
5
  *
6
6
  * Requires: jQuery 1.2.2+
7
7
  */
8
8
 
9
9
  (function (factory) {
10
- if ( typeof define === 'function' && define.amd ) {
11
- // AMD. Register as an anonymous module.
12
- define(['jquery'], factory);
13
- } else if (typeof exports === 'object') {
14
- // Node/CommonJS style for Browserify
15
- module.exports = factory;
16
- } else {
17
- // Browser globals
18
- factory(jQuery);
19
- }
10
+ if ( typeof define === 'function' && define.amd ) {
11
+ // AMD. Register as an anonymous module.
12
+ define(['jquery'], factory);
13
+ } else if (typeof exports === 'object') {
14
+ // Node/CommonJS style for Browserify
15
+ module.exports = factory;
16
+ } else {
17
+ // Browser globals
18
+ factory(jQuery);
19
+ }
20
20
  }(function ($) {
21
21
 
22
- var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
23
- toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
24
- ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
25
- slice = Array.prototype.slice,
26
- nullLowestDeltaTimeout, lowestDelta;
22
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
23
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
24
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
25
+ slice = Array.prototype.slice,
26
+ nullLowestDeltaTimeout, lowestDelta;
27
27
 
28
- if ( $.event.fixHooks ) {
29
- for ( var i = toFix.length; i; ) {
30
- $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
31
- }
28
+ if ( $.event.fixHooks ) {
29
+ for ( var i = toFix.length; i; ) {
30
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
32
31
  }
32
+ }
33
33
 
34
- var special = $.event.special.mousewheel = {
35
- version: '3.1.9',
36
-
37
- setup: function() {
38
- if ( this.addEventListener ) {
39
- for ( var i = toBind.length; i; ) {
40
- this.addEventListener( toBind[--i], handler, false );
41
- }
42
- } else {
43
- this.onmousewheel = handler;
44
- }
45
- // Store the line height and page height for this particular element
46
- $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
47
- $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
48
- },
49
-
50
- teardown: function() {
51
- if ( this.removeEventListener ) {
52
- for ( var i = toBind.length; i; ) {
53
- this.removeEventListener( toBind[--i], handler, false );
54
- }
55
- } else {
56
- this.onmousewheel = null;
57
- }
58
- },
59
-
60
- getLineHeight: function(elem) {
61
- return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
62
- },
63
-
64
- getPageHeight: function(elem) {
65
- return $(elem).height();
66
- },
67
-
68
- settings: {
69
- adjustOldDeltas: true
70
- }
71
- };
34
+ var special = $.event.special.mousewheel = {
35
+ version: '3.1.11',
72
36
 
73
- $.fn.extend({
74
- mousewheel: function(fn) {
75
- return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
76
- },
77
-
78
- unmousewheel: function(fn) {
79
- return this.unbind('mousewheel', fn);
37
+ setup: function() {
38
+ if ( this.addEventListener ) {
39
+ for ( var i = toBind.length; i; ) {
40
+ this.addEventListener( toBind[--i], handler, false );
80
41
  }
81
- });
82
-
83
-
84
- function handler(event) {
85
- var orgEvent = event || window.event,
86
- args = slice.call(arguments, 1),
87
- delta = 0,
88
- deltaX = 0,
89
- deltaY = 0,
90
- absDelta = 0;
91
- event = $.event.fix(orgEvent);
92
- event.type = 'mousewheel';
93
-
94
- // Old school scrollwheel delta
95
- if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
96
- if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
97
- if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
98
- if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
99
-
100
- // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
101
- if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
102
- deltaX = deltaY * -1;
103
- deltaY = 0;
42
+ } else {
43
+ this.onmousewheel = handler;
44
+ }
45
+ // Store the line height and page height for this particular element
46
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
47
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
48
+ },
49
+
50
+ teardown: function() {
51
+ if ( this.removeEventListener ) {
52
+ for ( var i = toBind.length; i; ) {
53
+ this.removeEventListener( toBind[--i], handler, false );
104
54
  }
55
+ } else {
56
+ this.onmousewheel = null;
57
+ }
58
+ // Clean up the data we added to the element
59
+ $.removeData(this, 'mousewheel-line-height');
60
+ $.removeData(this, 'mousewheel-page-height');
61
+ },
62
+
63
+ getLineHeight: function(elem) {
64
+ var $parent = $(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
65
+ if (!$parent.length) {
66
+ $parent = $('body');
67
+ }
68
+ return parseInt($parent.css('fontSize'), 10);
69
+ },
70
+
71
+ getPageHeight: function(elem) {
72
+ return $(elem).height();
73
+ },
74
+
75
+ settings: {
76
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
77
+ normalizeOffset: true // calls getBoundingClientRect for each event
78
+ }
79
+ };
105
80
 
106
- // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
107
- delta = deltaY === 0 ? deltaX : deltaY;
81
+ $.fn.extend({
82
+ mousewheel: function(fn) {
83
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
84
+ },
108
85
 
109
- // New school wheel delta (wheel event)
110
- if ( 'deltaY' in orgEvent ) {
111
- deltaY = orgEvent.deltaY * -1;
112
- delta = deltaY;
113
- }
114
- if ( 'deltaX' in orgEvent ) {
115
- deltaX = orgEvent.deltaX;
116
- if ( deltaY === 0 ) { delta = deltaX * -1; }
117
- }
86
+ unmousewheel: function(fn) {
87
+ return this.unbind('mousewheel', fn);
88
+ }
89
+ });
90
+
91
+
92
+ function handler(event) {
93
+ var orgEvent = event || window.event,
94
+ args = slice.call(arguments, 1),
95
+ delta = 0,
96
+ deltaX = 0,
97
+ deltaY = 0,
98
+ absDelta = 0,
99
+ offsetX = 0,
100
+ offsetY = 0;
101
+ event = $.event.fix(orgEvent);
102
+ event.type = 'mousewheel';
103
+
104
+ // Old school scrollwheel delta
105
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
106
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
107
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
108
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
109
+
110
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
111
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
112
+ deltaX = deltaY * -1;
113
+ deltaY = 0;
114
+ }
118
115
 
119
- // No change actually happened, no reason to go any further
120
- if ( deltaY === 0 && deltaX === 0 ) { return; }
121
-
122
- // Need to convert lines and pages to pixels if we aren't already in pixels
123
- // There are three delta modes:
124
- // * deltaMode 0 is by pixels, nothing to do
125
- // * deltaMode 1 is by lines
126
- // * deltaMode 2 is by pages
127
- if ( orgEvent.deltaMode === 1 ) {
128
- var lineHeight = $.data(this, 'mousewheel-line-height');
129
- delta *= lineHeight;
130
- deltaY *= lineHeight;
131
- deltaX *= lineHeight;
132
- } else if ( orgEvent.deltaMode === 2 ) {
133
- var pageHeight = $.data(this, 'mousewheel-page-height');
134
- delta *= pageHeight;
135
- deltaY *= pageHeight;
136
- deltaX *= pageHeight;
137
- }
116
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
117
+ delta = deltaY === 0 ? deltaX : deltaY;
138
118
 
139
- // Store lowest absolute delta to normalize the delta values
140
- absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
119
+ // New school wheel delta (wheel event)
120
+ if ( 'deltaY' in orgEvent ) {
121
+ deltaY = orgEvent.deltaY * -1;
122
+ delta = deltaY;
123
+ }
124
+ if ( 'deltaX' in orgEvent ) {
125
+ deltaX = orgEvent.deltaX;
126
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
127
+ }
141
128
 
142
- if ( !lowestDelta || absDelta < lowestDelta ) {
143
- lowestDelta = absDelta;
129
+ // No change actually happened, no reason to go any further
130
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
131
+
132
+ // Need to convert lines and pages to pixels if we aren't already in pixels
133
+ // There are three delta modes:
134
+ // * deltaMode 0 is by pixels, nothing to do
135
+ // * deltaMode 1 is by lines
136
+ // * deltaMode 2 is by pages
137
+ if ( orgEvent.deltaMode === 1 ) {
138
+ var lineHeight = $.data(this, 'mousewheel-line-height');
139
+ delta *= lineHeight;
140
+ deltaY *= lineHeight;
141
+ deltaX *= lineHeight;
142
+ } else if ( orgEvent.deltaMode === 2 ) {
143
+ var pageHeight = $.data(this, 'mousewheel-page-height');
144
+ delta *= pageHeight;
145
+ deltaY *= pageHeight;
146
+ deltaX *= pageHeight;
147
+ }
144
148
 
145
- // Adjust older deltas if necessary
146
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
147
- lowestDelta /= 40;
148
- }
149
- }
149
+ // Store lowest absolute delta to normalize the delta values
150
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
150
151
 
151
- // Adjust older deltas if necessary
152
- if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
153
- // Divide all the things by 40!
154
- delta /= 40;
155
- deltaX /= 40;
156
- deltaY /= 40;
157
- }
152
+ if ( !lowestDelta || absDelta < lowestDelta ) {
153
+ lowestDelta = absDelta;
158
154
 
159
- // Get a whole, normalized value for the deltas
160
- delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
161
- deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
162
- deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
163
-
164
- // Add information to the event object
165
- event.deltaX = deltaX;
166
- event.deltaY = deltaY;
167
- event.deltaFactor = lowestDelta;
168
- // Go ahead and set deltaMode to 0 since we converted to pixels
169
- // Although this is a little odd since we overwrite the deltaX/Y
170
- // properties with normalized deltas.
171
- event.deltaMode = 0;
172
-
173
- // Add event and delta to the front of the arguments
174
- args.unshift(event, delta, deltaX, deltaY);
175
-
176
- // Clearout lowestDelta after sometime to better
177
- // handle multiple device types that give different
178
- // a different lowestDelta
179
- // Ex: trackpad = 3 and mouse wheel = 120
180
- if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
181
- nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
182
-
183
- return ($.event.dispatch || $.event.handle).apply(this, args);
155
+ // Adjust older deltas if necessary
156
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
157
+ lowestDelta /= 40;
158
+ }
184
159
  }
185
160
 
186
- function nullLowestDelta() {
187
- lowestDelta = null;
161
+ // Adjust older deltas if necessary
162
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
163
+ // Divide all the things by 40!
164
+ delta /= 40;
165
+ deltaX /= 40;
166
+ deltaY /= 40;
188
167
  }
189
168
 
190
- function shouldAdjustOldDeltas(orgEvent, absDelta) {
191
- // If this is an older event and the delta is divisable by 120,
192
- // then we are assuming that the browser is treating this as an
193
- // older mouse wheel event and that we should divide the deltas
194
- // by 40 to try and get a more usable deltaFactor.
195
- // Side note, this actually impacts the reported scroll distance
196
- // in older browsers and can cause scrolling to be slower than native.
197
- // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
198
- return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
169
+ // Get a whole, normalized value for the deltas
170
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
171
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
172
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
173
+
174
+ // Normalise offsetX and offsetY properties
175
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
176
+ var boundingRect = this.getBoundingClientRect();
177
+ offsetX = event.clientX - boundingRect.left;
178
+ offsetY = event.clientY - boundingRect.top;
199
179
  }
200
180
 
181
+ // Add information to the event object
182
+ event.deltaX = deltaX;
183
+ event.deltaY = deltaY;
184
+ event.deltaFactor = lowestDelta;
185
+ event.offsetX = offsetX;
186
+ event.offsetY = offsetY;
187
+ // Go ahead and set deltaMode to 0 since we converted to pixels
188
+ // Although this is a little odd since we overwrite the deltaX/Y
189
+ // properties with normalized deltas.
190
+ event.deltaMode = 0;
191
+
192
+ // Add event and delta to the front of the arguments
193
+ args.unshift(event, delta, deltaX, deltaY);
194
+
195
+ // Clearout lowestDelta after sometime to better
196
+ // handle multiple device types that give different
197
+ // a different lowestDelta
198
+ // Ex: trackpad = 3 and mouse wheel = 120
199
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
200
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
201
+
202
+ return ($.event.dispatch || $.event.handle).apply(this, args);
203
+ }
204
+
205
+ function nullLowestDelta() {
206
+ lowestDelta = null;
207
+ }
208
+
209
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
210
+ // If this is an older event and the delta is divisable by 120,
211
+ // then we are assuming that the browser is treating this as an
212
+ // older mouse wheel event and that we should divide the deltas
213
+ // by 40 to try and get a more usable deltaFactor.
214
+ // Side note, this actually impacts the reported scroll distance
215
+ // in older browsers and can cause scrolling to be slower than native.
216
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
217
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
218
+ }
219
+
201
220
  }));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-mousewheel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike MacDonald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2014-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.14
113
+ rubygems_version: 2.0.5
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Integrates jquery-mousewheel with rails.