jquery-mousewheel-rails 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 926dbfd82a567c8b45a271a292f9372fba28a516
4
+ data.tar.gz: 21b9bbb2c2abebe586c90a4f00e7f8d363a36328
5
+ SHA512:
6
+ metadata.gz: 0e5566f3c60ddb3a9ebdba0b6f97f4f2ab96328644c36ee188550115d76b32d21407d6ec11985ab211723433b1ba403ab386c6bd42cba091eda3a5551100c12e
7
+ data.tar.gz: 91c1a94ec4bdb3fc5d0910d3f95ec99f8f302444188cdb38ffe253025013c2a0925b39f7a115b381d0b48faf005ca21ffc4c26fd55685e03d57b7e22b3fca248
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ test/dummy/db/*.sqlite3
5
5
  test/dummy/log/*.log
6
6
  test/dummy/tmp/
7
7
  test/dummy/.sass-cache
8
+ .idea/
@@ -1,65 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jquery-mousewheel-rails (0.0.2)
4
+ jquery-mousewheel-rails (0.0.4)
5
5
  railties (>= 3.1)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionpack (3.2.8)
11
- activemodel (= 3.2.8)
12
- activesupport (= 3.2.8)
13
- builder (~> 3.0.0)
10
+ actionpack (4.0.0)
11
+ activesupport (= 4.0.0)
12
+ builder (~> 3.1.0)
14
13
  erubis (~> 2.7.0)
15
- journey (~> 1.0.4)
16
- rack (~> 1.4.0)
17
- rack-cache (~> 1.2)
18
- rack-test (~> 0.6.1)
19
- sprockets (~> 2.1.3)
20
- activemodel (3.2.8)
21
- activesupport (= 3.2.8)
22
- builder (~> 3.0.0)
23
- activesupport (3.2.8)
24
- i18n (~> 0.6)
25
- multi_json (~> 1.0)
26
- builder (3.0.3)
14
+ rack (~> 1.5.2)
15
+ 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)
20
+ thread_safe (~> 0.1)
21
+ tzinfo (~> 0.3.37)
22
+ atomic (1.1.14)
23
+ builder (3.1.4)
27
24
  erubis (2.7.0)
28
- hike (1.2.1)
29
- i18n (0.6.1)
30
- journey (1.0.4)
31
- jquery-rails (2.1.3)
32
- railties (>= 3.1.0, < 5.0)
33
- thor (~> 0.14)
34
- json (1.7.5)
35
- multi_json (1.3.6)
36
- rack (1.4.1)
37
- rack-cache (1.2)
38
- rack (>= 0.4)
39
- rack-ssl (1.3.2)
40
- rack
25
+ i18n (0.6.5)
26
+ jquery-rails (3.0.4)
27
+ railties (>= 3.0, < 5.0)
28
+ thor (>= 0.14, < 2.0)
29
+ minitest (4.7.5)
30
+ multi_json (1.8.2)
31
+ rack (1.5.2)
41
32
  rack-test (0.6.2)
42
33
  rack (>= 1.0)
43
- railties (3.2.8)
44
- actionpack (= 3.2.8)
45
- activesupport (= 3.2.8)
46
- rack-ssl (~> 1.3.2)
34
+ railties (4.0.0)
35
+ actionpack (= 4.0.0)
36
+ activesupport (= 4.0.0)
47
37
  rake (>= 0.8.7)
48
- rdoc (~> 3.4)
49
- thor (>= 0.14.6, < 2.0)
50
- rake (0.9.2.2)
51
- rdoc (3.12)
52
- json (~> 1.4)
53
- sprockets (2.1.3)
54
- hike (~> 1.2)
55
- rack (~> 1.0)
56
- tilt (~> 1.1, != 1.3.0)
57
- sqlite3 (1.3.6)
58
- thor (0.16.0)
59
- tilt (1.3.3)
38
+ thor (>= 0.18.1, < 2.0)
39
+ rake (10.1.0)
40
+ sqlite3 (1.3.8)
41
+ sqlite3 (1.3.8-x86-mingw32)
42
+ thor (0.18.1)
43
+ thread_safe (0.1.3)
44
+ atomic
45
+ tzinfo (0.3.38)
60
46
 
61
47
  PLATFORMS
62
48
  ruby
49
+ x86-mingw32
63
50
 
64
51
  DEPENDENCIES
65
52
  jquery-mousewheel-rails!
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2013 Mike MacDonald
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,28 @@
1
+ # JqueryMousewheelRails
2
+
3
+ A ruby gem that uses the Rails asset pipeline to include the jQuery MouseWheel plugin by Brandon Aaron
4
+ (http://brandon.aaron.sh).
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem "jquery-mousewheel-rails"
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install jquery-mousewheel-rails
19
+
20
+ NOTE: this is a jQuery plugin so you will also need the `jquery-rails` gem:
21
+
22
+ * https://github.com/rails/jquery-rails
23
+
24
+ ## Usage
25
+
26
+ In your `application.js` you will need to add this line:
27
+
28
+ //= require jquery.mousewheel
@@ -1,3 +1,3 @@
1
1
  module JqueryMousewheelRails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,84 +1,122 @@
1
- /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
1
+ /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2
2
  * Licensed under the MIT License (LICENSE.txt).
3
3
  *
4
- * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
5
- * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
6
- * Thanks to: Seamus Leahy for adding deltaX and deltaY
4
+ * Version: 3.1.4
7
5
  *
8
- * Version: 3.0.6
9
- *
10
6
  * Requires: 1.2.2+
11
7
  */
12
8
 
13
- (function($) {
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
+ }
20
+ }(function ($) {
14
21
 
15
- var types = ['DOMMouseScroll', 'mousewheel'];
22
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
23
+ var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
24
+ var lowestDelta, lowestDeltaXY;
16
25
 
17
- if ($.event.fixHooks) {
18
- for ( var i=types.length; i; ) {
19
- $.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
26
+ if ( $.event.fixHooks ) {
27
+ for ( var i = toFix.length; i; ) {
28
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
29
+ }
20
30
  }
21
- }
22
31
 
23
- $.event.special.mousewheel = {
24
- setup: function() {
25
- if ( this.addEventListener ) {
26
- for ( var i=types.length; i; ) {
27
- this.addEventListener( types[--i], handler, false );
32
+ $.event.special.mousewheel = {
33
+ setup: function() {
34
+ if ( this.addEventListener ) {
35
+ for ( var i = toBind.length; i; ) {
36
+ this.addEventListener( toBind[--i], handler, false );
37
+ }
38
+ } else {
39
+ this.onmousewheel = handler;
28
40
  }
29
- } else {
30
- this.onmousewheel = handler;
31
- }
32
- },
33
-
34
- teardown: function() {
35
- if ( this.removeEventListener ) {
36
- for ( var i=types.length; i; ) {
37
- this.removeEventListener( types[--i], handler, false );
41
+ },
42
+
43
+ teardown: function() {
44
+ if ( this.removeEventListener ) {
45
+ for ( var i = toBind.length; i; ) {
46
+ this.removeEventListener( toBind[--i], handler, false );
47
+ }
48
+ } else {
49
+ this.onmousewheel = null;
38
50
  }
39
- } else {
40
- this.onmousewheel = null;
41
51
  }
52
+ };
53
+
54
+ $.fn.extend({
55
+ mousewheel: function(fn) {
56
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
57
+ },
58
+
59
+ unmousewheel: function(fn) {
60
+ return this.unbind('mousewheel', fn);
61
+ }
62
+ });
63
+
64
+
65
+ function handler(event) {
66
+ var orgEvent = event || window.event,
67
+ args = [].slice.call(arguments, 1),
68
+ delta = 0,
69
+ deltaX = 0,
70
+ deltaY = 0,
71
+ absDelta = 0,
72
+ absDeltaXY = 0,
73
+ fn;
74
+ event = $.event.fix(orgEvent);
75
+ event.type = 'mousewheel';
76
+
77
+ // Old school scrollwheel delta
78
+ if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
79
+ if ( orgEvent.detail ) { delta = orgEvent.detail * -1; }
80
+
81
+ // At a minimum, setup the deltaY to be delta
82
+ deltaY = delta;
83
+
84
+ // Firefox < 17 related to DOMMouseScroll event
85
+ if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
86
+ deltaY = 0;
87
+ deltaX = delta * -1;
88
+ }
89
+
90
+ // New school wheel delta (wheel event)
91
+ if ( orgEvent.deltaY ) {
92
+ deltaY = orgEvent.deltaY * -1;
93
+ delta = deltaY;
94
+ }
95
+ if ( orgEvent.deltaX ) {
96
+ deltaX = orgEvent.deltaX;
97
+ delta = deltaX * -1;
98
+ }
99
+
100
+ // Webkit
101
+ if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
102
+ if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
103
+
104
+ // Look for lowest delta to normalize the delta values
105
+ absDelta = Math.abs(delta);
106
+ if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
107
+ absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
108
+ if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
109
+
110
+ // Get a whole value for the deltas
111
+ fn = delta > 0 ? 'floor' : 'ceil';
112
+ delta = Math[fn](delta / lowestDelta);
113
+ deltaX = Math[fn](deltaX / lowestDeltaXY);
114
+ deltaY = Math[fn](deltaY / lowestDeltaXY);
115
+
116
+ // Add event and delta to the front of the arguments
117
+ args.unshift(event, delta, deltaX, deltaY);
118
+
119
+ return ($.event.dispatch || $.event.handle).apply(this, args);
42
120
  }
43
- };
44
-
45
- $.fn.extend({
46
- mousewheel: function(fn) {
47
- return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
48
- },
49
-
50
- unmousewheel: function(fn) {
51
- return this.unbind("mousewheel", fn);
52
- }
53
- });
54
-
55
-
56
- function handler(event) {
57
- var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
58
- event = $.event.fix(orgEvent);
59
- event.type = "mousewheel";
60
-
61
- // Old school scrollwheel delta
62
- if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
63
- if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
64
-
65
- // New school multidimensional scroll (touchpads) deltas
66
- deltaY = delta;
67
-
68
- // Gecko
69
- if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
70
- deltaY = 0;
71
- deltaX = -1*delta;
72
- }
73
-
74
- // Webkit
75
- if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
76
- if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
77
-
78
- // Add event and delta to the front of the arguments
79
- args.unshift(event, delta, deltaX, deltaY);
80
-
81
- return ($.event.dispatch || $.event.handle).apply(this, args);
82
- }
83
-
84
- })(jQuery);
121
+
122
+ }));
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-mousewheel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mike MacDonald
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-16 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.1'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.1'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sqlite3
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: ''
@@ -54,7 +49,7 @@ files:
54
49
  - Gemfile
55
50
  - Gemfile.lock
56
51
  - MIT-LICENSE
57
- - README.rdoc
52
+ - README.md
58
53
  - Rakefile
59
54
  - jquery-mousewheel-rails.gemspec
60
55
  - lib/jquery-mousewheel-rails.rb
@@ -97,33 +92,26 @@ files:
97
92
  - vendor/assets/javascripts/jquery.mousewheel.js
98
93
  homepage: https://github.com/crazymykl/jquery-mousewheel-rails
99
94
  licenses: []
95
+ metadata: {}
100
96
  post_install_message:
101
97
  rdoc_options: []
102
98
  require_paths:
103
99
  - lib
104
100
  required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
101
  requirements:
107
- - - ! '>='
102
+ - - '>='
108
103
  - !ruby/object:Gem::Version
109
104
  version: '0'
110
- segments:
111
- - 0
112
- hash: -1167816390643979616
113
105
  required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
106
  requirements:
116
- - - ! '>='
107
+ - - '>='
117
108
  - !ruby/object:Gem::Version
118
109
  version: '0'
119
- segments:
120
- - 0
121
- hash: -1167816390643979616
122
110
  requirements: []
123
111
  rubyforge_project:
124
- rubygems_version: 1.8.24
112
+ rubygems_version: 2.0.5
125
113
  signing_key:
126
- specification_version: 3
114
+ specification_version: 4
127
115
  summary: Integrates jquery-mousewheel with rails.
128
116
  test_files:
129
117
  - test/dummy/README.rdoc
@@ -1,3 +0,0 @@
1
- = JqueryMousewheelRails
2
-
3
- This project rocks and uses MIT-LICENSE.