scrollspy-rails 1.0.0

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: 1cfde48198798ba8216329880dea5b92d774a012
4
+ data.tar.gz: 6145493633c32cecc1e629dd9740d61c6eff3528
5
+ SHA512:
6
+ metadata.gz: bfc5884016a6b58d68f20c8bf526301666b90d111ad7adbffa6f5de05636932825b1ced37937a6a2ef969b41b1b73146cd5ca0fad585ee003a50904c1c2953e5
7
+ data.tar.gz: f149fa5ff5519f8106df284243bd9ac23efceddc78a9ddef042811bf578f87d810c3aec00970e37c10cc4ab2b31eb0f6ff8f3d65d9b25bc7993a9fcbb07646e2
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 scrollspy-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Kyle Szives
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Kyle Szives
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,30 @@
1
+ <<<<<<< HEAD
2
+ # Scrollspy::Rails
3
+
4
+ TODO: Write a gem description
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'scrollspy-rails'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install scrollspy-rails
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/[my-github-username]/scrollspy-rails/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,5 @@
1
+ module Scrollspy
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "scrollspy/rails/version"
2
+
3
+ module Scrollspy
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -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 'scrollspy/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrollspy-rails"
8
+ spec.version = Scrollspy::Rails::VERSION
9
+ spec.authors = ["Kyle Szives"]
10
+ spec.email = ["kjszives@gmail.com"]
11
+ spec.summary = %q{Rails implementation of scrollspy}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib", "vender"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+
23
+ spec.add_dependency "railties", "~> 3.1"
24
+ end
@@ -0,0 +1,98 @@
1
+ /*!
2
+ * jQuery Scrollspy Plugin
3
+ * Author: @sxalexander
4
+ * Licensed under the MIT license
5
+ */
6
+
7
+
8
+ ;(function ( $, window, document, undefined ) {
9
+
10
+ $.fn.extend({
11
+ scrollspy: function ( options ) {
12
+
13
+ var defaults = {
14
+ min: 0,
15
+ max: 0,
16
+ mode: 'vertical',
17
+ buffer: 0,
18
+ container: window,
19
+ onEnter: options.onEnter ? options.onEnter : [],
20
+ onLeave: options.onLeave ? options.onLeave : [],
21
+ onTick: options.onTick ? options.onTick : []
22
+ }
23
+
24
+ var options = $.extend( {}, defaults, options );
25
+
26
+ return this.each(function (i) {
27
+
28
+ var element = this;
29
+ var o = options;
30
+ var $container = $(o.container);
31
+ var mode = o.mode;
32
+ var buffer = o.buffer;
33
+ var enters = leaves = 0;
34
+ var inside = false;
35
+
36
+ /* add listener to container */
37
+ $container.bind('scroll', function(e){
38
+ var position = {top: $(this).scrollTop(), left: $(this).scrollLeft()};
39
+ var xy = (mode == 'vertical') ? position.top + buffer : position.left + buffer;
40
+ var max = o.max;
41
+ var min = o.min;
42
+
43
+ /* fix max */
44
+ if($.isFunction(o.max)){
45
+ max = o.max();
46
+ }
47
+
48
+ /* fix max */
49
+ if($.isFunction(o.min)){
50
+ min = o.min();
51
+ }
52
+
53
+ if(max == 0){
54
+ max = (mode == 'vertical') ? $container.height() : $container.outerWidth() + $(element).outerWidth();
55
+ }
56
+
57
+ /* if we have reached the minimum bound but are below the max ... */
58
+ if(xy >= min && xy <= max){
59
+ /* trigger enter event */
60
+ if(!inside){
61
+ inside = true;
62
+ enters++;
63
+
64
+ /* fire enter event */
65
+ $(element).trigger('scrollEnter', {position: position})
66
+ if($.isFunction(o.onEnter)){
67
+ o.onEnter(element, position);
68
+ }
69
+
70
+ }
71
+
72
+ /* triger tick event */
73
+ $(element).trigger('scrollTick', {position: position, inside: inside, enters: enters, leaves: leaves})
74
+ if($.isFunction(o.onTick)){
75
+ o.onTick(element, position, inside, enters, leaves);
76
+ }
77
+ }else{
78
+
79
+ if(inside){
80
+ inside = false;
81
+ leaves++;
82
+ /* trigger leave event */
83
+ $(element).trigger('scrollLeave', {position: position, leaves:leaves})
84
+
85
+ if($.isFunction(o.onLeave)){
86
+ o.onLeave(element, position);
87
+ }
88
+ }
89
+ }
90
+ });
91
+
92
+ });
93
+ }
94
+
95
+ })
96
+
97
+
98
+ })( jQuery, window );
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrollspy-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kyle Szives
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-08 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:
56
+ email:
57
+ - kjszives@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/scrollspy/rails.rb
69
+ - lib/scrollspy/rails/version.rb
70
+ - scrollspy-rails.gemspec
71
+ - vendor/assets/jquery.scrollspy.js
72
+ homepage: ''
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ - vender
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.3.0
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Rails implementation of scrollspy
97
+ test_files: []