mwheelintent-rails 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTE0NDU5YWJkYjlhY2ZhZmZjMmM1ZmRlYjM5OWViOTIzZDhjMDdlMg==
5
+ data.tar.gz: !binary |-
6
+ MzFiZDBiODkyNGU1NTM0NjY5NTBkMjMxNTAwY2JiNTkxYTYwZTlmYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Mjk0MzJiNDNkMjBiOGRiMGRjOTk2MDExOGIwNWQzZDBiNmFhOWFlNTMzNGE0
10
+ Yzk3YTI4NzVkZGMyZjY0MWQyZTdiOTdhYWZlNmFkYjQwOGUzZjE0MmI2ZWI1
11
+ MjYyMTE3NGQ1ZTlkMWU5NjM2ZjQwODcyMTBhM2NlYjhhMWJlMDg=
12
+ data.tar.gz: !binary |-
13
+ YWVhZDFjOTNlNzc4OWI2ZmIwMDY3MTZiOWNjMGVmMzUzNDIwMDc2MDZmODJj
14
+ Y2E1MTZiZDJjZDZkMmI1MDhkNDVhNWMzZDc2MDY5MGMxOThjZTJlMWI0NGYy
15
+ YTdiYzcyNjgyOWM4OWFiM2NmZjlhNTU0Mzg5MmFhNjEwMmVlNTk=
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ilya Bodrov
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,35 @@
1
+ # jQuery MouseWheel Intent plugin for Rails
2
+
3
+ A ruby gem that uses the Rails asset pipeline to include the jQuery MouseWheel Intent plugin by trixta.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'mwheelintent-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install mwheelintent-rails
18
+
19
+ NOTE: this is a jQuery plugin so you will also need the `jquery-rails` gem:
20
+
21
+ * https://github.com/rails/jquery-rails
22
+
23
+ ## Usage
24
+
25
+ In your `application.js` you will need to add this line:
26
+
27
+ //= require mwheelintent
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "mwheelintent-rails/version"
2
+
3
+ module MWheelIntent
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module MWheelIntent
2
+ module Rails
3
+ VERSION = "1.2"
4
+ end
5
+ end
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @author trixta
3
+ * @version 1.2
4
+ */
5
+ (function($){
6
+
7
+ var mwheelI = {
8
+ pos: [-260, -260]
9
+ },
10
+ minDif = 3,
11
+ doc = document,
12
+ root = doc.documentElement,
13
+ body = doc.body,
14
+ longDelay, shortDelay
15
+ ;
16
+
17
+ function unsetPos(){
18
+ if(this === mwheelI.elem){
19
+ mwheelI.pos = [-260, -260];
20
+ mwheelI.elem = false;
21
+ minDif = 3;
22
+ }
23
+ }
24
+
25
+ $.event.special.mwheelIntent = {
26
+ setup: function(){
27
+ var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler);
28
+ if( this !== doc && this !== root && this !== body ){
29
+ jElm.bind('mouseleave', unsetPos);
30
+ }
31
+ jElm = null;
32
+ return true;
33
+ },
34
+ teardown: function(){
35
+ $(this)
36
+ .unbind('mousewheel', $.event.special.mwheelIntent.handler)
37
+ .unbind('mouseleave', unsetPos)
38
+ ;
39
+ return true;
40
+ },
41
+ handler: function(e, d){
42
+ var pos = [e.clientX, e.clientY];
43
+ if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif ){
44
+ mwheelI.elem = this;
45
+ mwheelI.pos = pos;
46
+ minDif = 250;
47
+
48
+ clearTimeout(shortDelay);
49
+ shortDelay = setTimeout(function(){
50
+ minDif = 10;
51
+ }, 200);
52
+ clearTimeout(longDelay);
53
+ longDelay = setTimeout(function(){
54
+ minDif = 3;
55
+ }, 1500);
56
+ e = $.extend({}, e, {type: 'mwheelIntent'});
57
+ return $.event.dispatch.apply(this, arguments);
58
+ }
59
+ }
60
+ };
61
+ $.fn.extend({
62
+ mwheelIntent: function(fn) {
63
+ return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent");
64
+ },
65
+
66
+ unmwheelIntent: function(fn) {
67
+ return this.unbind("mwheelIntent", fn);
68
+ }
69
+ });
70
+
71
+ $(function(){
72
+ body = doc.body;
73
+ //assume that document is always scrollable, doesn't hurt if not
74
+ $(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop);
75
+ });
76
+ })(jQuery);
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mwheelintent-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.2'
5
+ platform: ruby
6
+ authors:
7
+ - Ilya Bodrov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ description: ! 'A ruby gem that uses the Rails asset pipeline to include the jQuery
28
+ MouseWheel Intent
29
+
30
+ plugin by trixta.'
31
+ email:
32
+ - golosizpru@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/mwheelintent-rails/version.rb
38
+ - lib/mwheelintent-rails.rb
39
+ - vendor/assets/javascripts/mwheelintent.js
40
+ - LICENSE
41
+ - README.md
42
+ homepage: https://github.com/bodrovis/mwheelintent-rails
43
+ licenses: []
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.0.7
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Includes javascript and css files for the jQuery MouseWheel Intent plugin.
65
+ test_files: []