jquery-mousewheel-rails 0.0.6 → 0.0.7

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: 06772f314185b1cbd581918cd5f595bd2e34d377
4
- data.tar.gz: 15a09792ecb91bd62a4853339be395c557408aaa
3
+ metadata.gz: 091ff6904ab24e276d443180db638de29f0cef9f
4
+ data.tar.gz: d558433c382650d87f1b875f8653d5872022a3ca
5
5
  SHA512:
6
- metadata.gz: ce4639fe93209555a8638f63d3241e36bc91fc7d2f4580e46c5e91db7b5ad3f670a7339ad61dc2033401a7700a647f69b70d946789df86e47da836da587ba4e6
7
- data.tar.gz: 1684d55af7336c9a34e969e169249e4b858ef51a67bb730ae5df1e876950c81dce4818b2b055545ad8ccb0bc7d80563fea858bd07808a629524c4e84c2732602
6
+ metadata.gz: 8881145db9b1e0d0be3efe492b28b3d9d2d7be7e37ad4951a71a6182450b4b36beba8076f26654899c825f9940c2b82fd797b509c24a41f5752accf66f980d65
7
+ data.tar.gz: 25117fd4b49e9f9382b8f5dae69857972a4583c5913aeae5d95580cc6b2ba2370103f672d9e9d99e31ac3c5ee2eec709e4986c2baf120672929f5b1d0fc904eb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jquery-mousewheel-rails (0.0.6)
4
+ jquery-mousewheel-rails (0.0.7)
5
5
  railties (>= 3.1)
6
6
 
7
7
  GEM
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
17
  s.require_paths = ["lib"]
18
+ s.license = 'MIT'
18
19
 
19
20
  s.add_runtime_dependency 'railties', '>= 3.1'
20
21
  s.add_development_dependency "sqlite3"
@@ -1,3 +1,3 @@
1
1
  module JqueryMousewheelRails
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,7 +1,7 @@
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.8
4
+ * Version: 3.1.9
5
5
  *
6
6
  * Requires: jQuery 1.2.2+
7
7
  */
@@ -21,9 +21,9 @@
21
21
 
22
22
  var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
23
23
  toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
24
- ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
24
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
25
25
  slice = Array.prototype.slice,
26
- oldMode, nullLowestDeltaTimeout, lowestDelta;
26
+ nullLowestDeltaTimeout, lowestDelta;
27
27
 
28
28
  if ( $.event.fixHooks ) {
29
29
  for ( var i = toFix.length; i; ) {
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  var special = $.event.special.mousewheel = {
35
- version: '3.1.8',
35
+ version: '3.1.9',
36
36
 
37
37
  setup: function() {
38
38
  if ( this.addEventListener ) {
@@ -63,6 +63,10 @@
63
63
 
64
64
  getPageHeight: function(elem) {
65
65
  return $(elem).height();
66
+ },
67
+
68
+ settings: {
69
+ adjustOldDeltas: true
66
70
  }
67
71
  };
68
72
 
@@ -138,18 +142,14 @@
138
142
  if ( !lowestDelta || absDelta < lowestDelta ) {
139
143
  lowestDelta = absDelta;
140
144
 
141
- // Assuming that if the lowestDelta is 120, then that the browser
142
- // is treating this as an older mouse wheel event.
143
- // We'll divide it by 40 to try and get a more usable deltaFactor.
144
- if ( lowestDelta === 120 ) {
145
- oldMode = true;
145
+ // Adjust older deltas if necessary
146
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
146
147
  lowestDelta /= 40;
147
148
  }
148
149
  }
149
150
 
150
- // When in oldMode the delta is based on 120.
151
- // Dividing by 40 to try and get a more usable deltaFactor.
152
- if ( oldMode ) {
151
+ // Adjust older deltas if necessary
152
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
153
153
  // Divide all the things by 40!
154
154
  delta /= 40;
155
155
  deltaX /= 40;
@@ -185,7 +185,17 @@
185
185
 
186
186
  function nullLowestDelta() {
187
187
  lowestDelta = null;
188
- oldMode = null;
188
+ }
189
+
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;
189
199
  }
190
200
 
191
201
  }));
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.6
4
+ version: 0.0.7
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-16 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -91,7 +91,8 @@ files:
91
91
  - test/test_helper.rb
92
92
  - vendor/assets/javascripts/jquery.mousewheel.js
93
93
  homepage: https://github.com/crazymykl/jquery-mousewheel-rails
94
- licenses: []
94
+ licenses:
95
+ - MIT
95
96
  metadata: {}
96
97
  post_install_message:
97
98
  rdoc_options: []