infinitescrolling-rails 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +85 -0
- data/README.md +9 -0
- data/Rakefile +4 -0
- data/infinitescrolling-rails.gemspec +23 -0
- data/lib/generators/infinitescrolling/install/install_generator.rb +16 -0
- data/lib/infinitescrolling/rails/railtie.rb +12 -0
- data/lib/infinitescrolling/rails.rb +5 -0
- data/lib/infinitescrolling-rails.rb +1 -0
- data/vendor/assets/javascripts/infinitescrolling.js +44 -0
- metadata +103 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
infinitescrolling-rails (0.1.2)
|
5
|
+
jquery-rails
|
6
|
+
railties (~> 3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
abstract (1.0.0)
|
12
|
+
actionmailer (3.0.9)
|
13
|
+
actionpack (= 3.0.9)
|
14
|
+
mail (~> 2.2.19)
|
15
|
+
actionpack (3.0.9)
|
16
|
+
activemodel (= 3.0.9)
|
17
|
+
activesupport (= 3.0.9)
|
18
|
+
builder (~> 2.1.2)
|
19
|
+
erubis (~> 2.6.6)
|
20
|
+
i18n (~> 0.5.0)
|
21
|
+
rack (~> 1.2.1)
|
22
|
+
rack-mount (~> 0.6.14)
|
23
|
+
rack-test (~> 0.5.7)
|
24
|
+
tzinfo (~> 0.3.23)
|
25
|
+
activemodel (3.0.9)
|
26
|
+
activesupport (= 3.0.9)
|
27
|
+
builder (~> 2.1.2)
|
28
|
+
i18n (~> 0.5.0)
|
29
|
+
activerecord (3.0.9)
|
30
|
+
activemodel (= 3.0.9)
|
31
|
+
activesupport (= 3.0.9)
|
32
|
+
arel (~> 2.0.10)
|
33
|
+
tzinfo (~> 0.3.23)
|
34
|
+
activeresource (3.0.9)
|
35
|
+
activemodel (= 3.0.9)
|
36
|
+
activesupport (= 3.0.9)
|
37
|
+
activesupport (3.0.9)
|
38
|
+
arel (2.0.10)
|
39
|
+
builder (2.1.2)
|
40
|
+
erubis (2.6.6)
|
41
|
+
abstract (>= 1.0.0)
|
42
|
+
i18n (0.5.0)
|
43
|
+
jquery-rails (1.0.12)
|
44
|
+
railties (~> 3.0)
|
45
|
+
thor (~> 0.14)
|
46
|
+
mail (2.2.19)
|
47
|
+
activesupport (>= 2.3.6)
|
48
|
+
i18n (>= 0.4.0)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
51
|
+
mime-types (1.16)
|
52
|
+
polyglot (0.3.1)
|
53
|
+
rack (1.2.3)
|
54
|
+
rack-mount (0.6.14)
|
55
|
+
rack (>= 1.0.0)
|
56
|
+
rack-test (0.5.7)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.0.9)
|
59
|
+
actionmailer (= 3.0.9)
|
60
|
+
actionpack (= 3.0.9)
|
61
|
+
activerecord (= 3.0.9)
|
62
|
+
activeresource (= 3.0.9)
|
63
|
+
activesupport (= 3.0.9)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.0.9)
|
66
|
+
railties (3.0.9)
|
67
|
+
actionpack (= 3.0.9)
|
68
|
+
activesupport (= 3.0.9)
|
69
|
+
rake (>= 0.8.7)
|
70
|
+
rdoc (~> 3.4)
|
71
|
+
thor (~> 0.14.4)
|
72
|
+
rake (0.9.2)
|
73
|
+
rdoc (3.8)
|
74
|
+
thor (0.14.6)
|
75
|
+
treetop (1.4.9)
|
76
|
+
polyglot (>= 0.3.1)
|
77
|
+
tzinfo (0.3.29)
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler (~> 1.0.0)
|
84
|
+
infinitescrolling-rails!
|
85
|
+
rails (~> 3.0)
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "infinitescrolling-rails"
|
5
|
+
s.version = "0.1.2"
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ["Leif Bladt"]
|
8
|
+
s.email = ["leif.bladt@gmx.de"]
|
9
|
+
s.homepage = "https://github.com/leifbladt/infinite_scrolling-rails"
|
10
|
+
s.summary = "Use the infinite scrolling jQuery plugin with Rails 3"
|
11
|
+
s.description = "This gem provides the infinite scrolling jQuery plugin for your Rails 3 application."
|
12
|
+
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
14
|
+
|
15
|
+
s.add_dependency "railties", "~> 3.0"
|
16
|
+
s.add_dependency "jquery-rails"
|
17
|
+
s.add_development_dependency "bundler", "~> 1.0.0"
|
18
|
+
s.add_development_dependency "rails", "~> 3.0"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
22
|
+
s.require_path = 'lib'
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module Infinitescrolling
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
|
7
|
+
desc "This generator installs the infinite scrolling jQuery plugin"
|
8
|
+
source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
|
9
|
+
|
10
|
+
def copy_infinitescrolling
|
11
|
+
say_status("copying", "infinite scrolling jQuery plugin", :green)
|
12
|
+
copy_file "infinitescrolling.js", "public/javascripts/infinitescrolling.js"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Configure Rails 3.0 to use public/javascripts/infinite_scrolling.js
|
2
|
+
module Infinitescrolling
|
3
|
+
module Rails
|
4
|
+
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
#config.before_configuration do
|
7
|
+
# config.action_view.javascript_expansions[:defaults] << 'infinitescrolling.js'
|
8
|
+
#end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'infinitescrolling/rails'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
(function($){
|
2
|
+
var my = {
|
3
|
+
marginThreshold: 20,
|
4
|
+
|
5
|
+
delay: 250,
|
6
|
+
|
7
|
+
hasScrolled: false,
|
8
|
+
|
9
|
+
callback: function(){
|
10
|
+
if (!my.hasScrolled){
|
11
|
+
my.hasScrolled = true;
|
12
|
+
setTimeout(my.checkScroll, my.delay);
|
13
|
+
}
|
14
|
+
},
|
15
|
+
|
16
|
+
checkScroll: function() {
|
17
|
+
my.hasScrolled = false;
|
18
|
+
if (my.lowEnough()) {
|
19
|
+
my.loadCallback();
|
20
|
+
}
|
21
|
+
},
|
22
|
+
|
23
|
+
lowEnough: function() {
|
24
|
+
var pageHeight = Math.max(document.body.scrollHeight,
|
25
|
+
document.body.offsetHeight);
|
26
|
+
var viewportHeight = window.innerHeight ||
|
27
|
+
document.documentElement.clientHeight ||
|
28
|
+
document.body.clientHeight || 0;
|
29
|
+
var scrollHeight = window.pageYOffset ||
|
30
|
+
document.documentElement.scrollTop ||
|
31
|
+
document.body.scrollTop || 0;
|
32
|
+
|
33
|
+
// Trigger for scrolls within 20 pixels from page bottom
|
34
|
+
return pageHeight - viewportHeight - scrollHeight < my.marginThreshold;
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
$.fn.infiniteScrolling = function(loadCallback){
|
39
|
+
my.loadCallback = loadCallback;
|
40
|
+
this.bind('scroll', my.callback);
|
41
|
+
this.bind('resize', my.callback);
|
42
|
+
return this;
|
43
|
+
};
|
44
|
+
})(jQuery);
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: infinitescrolling-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Leif Bladt
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-07-25 00:00:00.000000000 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: railties
|
17
|
+
requirement: &2154757240 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2154757240
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jquery-rails
|
28
|
+
requirement: &2154756800 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2154756800
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: bundler
|
39
|
+
requirement: &2154756080 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.0.0
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2154756080
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rails
|
50
|
+
requirement: &2154755460 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2154755460
|
59
|
+
description: This gem provides the infinite scrolling jQuery plugin for your Rails
|
60
|
+
3 application.
|
61
|
+
email:
|
62
|
+
- leif.bladt@gmx.de
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- .gitignore
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- infinitescrolling-rails.gemspec
|
73
|
+
- lib/generators/infinitescrolling/install/install_generator.rb
|
74
|
+
- lib/infinitescrolling-rails.rb
|
75
|
+
- lib/infinitescrolling/rails.rb
|
76
|
+
- lib/infinitescrolling/rails/railtie.rb
|
77
|
+
- vendor/assets/javascripts/infinitescrolling.js
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: https://github.com/leifbladt/infinite_scrolling-rails
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.3.6
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.6.2
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Use the infinite scrolling jQuery plugin with Rails 3
|
103
|
+
test_files: []
|