jquery_mousewheel_rails 3.1.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 114736ae4aeedf062255f65011ca399e1774d32b
4
+ data.tar.gz: 19373450b40f98b04b3f3c403526d34ef50eba87
5
+ SHA512:
6
+ metadata.gz: 8e59d3560627465a8de955c41ea4313eb712cd900b2a8e9e593ead863c534bfc8830336b0e8e9499c6a2213d38896a7aeeb70c7863d5e3e48e99cd9bf058bff6
7
+ data.tar.gz: b466bc57303a6196f4d3e595d4284874e1451e551322152e5e440f6cce571052f9bb6dad3045e043bdb9421c395ddf262646ceed4eea82db3fec1abf2fd66bc7
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jquery-mousewheel_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Guy Israeli
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # JqueryMousewheelRails
2
+
3
+ Rails asset-pipeline compatible gem wrapper for jQuery-Mousewheel.js
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'jquery-mousewheel_rails'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install jquery-mousewheel_rails
17
+
18
+ ## Usage
19
+
20
+ add this to application.js manifest
21
+
22
+ //= require jquery-mousewheel
23
+
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/jquery-mousewheel_rails/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,220 @@
1
+ /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2
+ * Licensed under the MIT License (LICENSE.txt).
3
+ *
4
+ * Version: 3.1.11
5
+ *
6
+ * Requires: jQuery 1.2.2+
7
+ */
8
+
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 ($) {
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;
27
+
28
+ if ( $.event.fixHooks ) {
29
+ for ( var i = toFix.length; i; ) {
30
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
31
+ }
32
+ }
33
+
34
+ var special = $.event.special.mousewheel = {
35
+ version: '3.1.11',
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
+ // 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
+ };
80
+
81
+ $.fn.extend({
82
+ mousewheel: function(fn) {
83
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
84
+ },
85
+
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
+ }
115
+
116
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
117
+ delta = deltaY === 0 ? deltaX : deltaY;
118
+
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
+ }
128
+
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
+ }
148
+
149
+ // Store lowest absolute delta to normalize the delta values
150
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
151
+
152
+ if ( !lowestDelta || absDelta < lowestDelta ) {
153
+ lowestDelta = absDelta;
154
+
155
+ // Adjust older deltas if necessary
156
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
157
+ lowestDelta /= 40;
158
+ }
159
+ }
160
+
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;
167
+ }
168
+
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;
179
+ }
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
+
220
+ }));
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jquery_mousewheel_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jquery_mousewheel_rails"
8
+ spec.version = JqueryMousewheelRails::VERSION
9
+ spec.authors = ["Guy Israeli"]
10
+ spec.email = ["guy.israeli@gmail.com"]
11
+ spec.summary = %q{Rails asset-pipeline compatible gem wrapper for jQuery-Mousewheel.js}
12
+ spec.description = %q{Rails asset-pipeline compatible gem wrapper for jQuery-Mousewheel.js}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "railties", ">= 3.1"
24
+ end
@@ -0,0 +1,8 @@
1
+ require "jquery_mousewheel_rails/version"
2
+
3
+ module JqueryMousewheelRails
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module JqueryMousewheelRails
2
+ VERSION = "3.1.11.3"
3
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery_mousewheel_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.11.3
5
+ platform: ruby
6
+ authors:
7
+ - Guy Israeli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: Rails asset-pipeline compatible gem wrapper for jQuery-Mousewheel.js
56
+ email:
57
+ - guy.israeli@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - app/assets/javascripts/jquery.mousewheel.js
68
+ - jquery_mousewheel_rails.gemspec
69
+ - lib/jquery_mousewheel_rails.rb
70
+ - lib/jquery_mousewheel_rails/version.rb
71
+ homepage: ''
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Rails asset-pipeline compatible gem wrapper for jQuery-Mousewheel.js
95
+ test_files: []
96
+ has_rdoc: