spaghetti 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
data/lib/spaghetti/version.rb
CHANGED
@@ -1,22 +1,35 @@
|
|
1
1
|
$(function() {
|
2
|
+
function nearBottomOfPage() {
|
3
|
+
return $(window).scrollTop() > $(document).height() - $(window).height() - 200;
|
4
|
+
}
|
5
|
+
|
6
|
+
function triggerHooks(hook) {
|
7
|
+
fn = hook + '_spaghetti';
|
8
|
+
console.log('Triggering hook: ' + hook);
|
9
|
+
if (typeof window.fn == 'function') {
|
10
|
+
fireHook(fn);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
function fireHook(func){
|
15
|
+
this[func].apply(this, Array.prototype.slice.call(arguments, 1));
|
16
|
+
}
|
17
|
+
|
2
18
|
$('.spaghetti-empty').each(function() {
|
3
19
|
$.ajax({
|
4
20
|
url: $(this).data('spaghetti-url') + '?page=' + $(this).data('spaghetti-next-page'),
|
5
21
|
type: 'get',
|
6
22
|
dataType: 'script',
|
7
23
|
success: function() {
|
8
|
-
$(window).sausage('draw');
|
9
24
|
$(this).removeClass('spaghetti-empty');
|
10
25
|
}
|
11
26
|
});
|
12
27
|
});
|
13
|
-
|
14
|
-
return $(window).scrollTop() > $(document).height() - $(window).height() - 200;
|
15
|
-
}
|
16
|
-
|
28
|
+
|
17
29
|
$(window).scroll(function(){
|
18
30
|
if ($('.spaghetti').data('spaghetti-enabled') == 1) {
|
19
31
|
if(nearBottomOfPage()) {
|
32
|
+
triggerHooks('pre');
|
20
33
|
$('.spaghetti').data('spaghetti-enabled', 0);
|
21
34
|
$('.spaghetti').addClass('spaghetti-loading');
|
22
35
|
$.ajax({
|
@@ -25,6 +38,7 @@ $(function() {
|
|
25
38
|
dataType: 'script',
|
26
39
|
success: function() {
|
27
40
|
$(window).sausage('draw');
|
41
|
+
triggerHooks('post');
|
28
42
|
}
|
29
43
|
});
|
30
44
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaghetti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: -3824356081192131783
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: -3824356081192131783
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
78
|
rubygems_version: 1.8.24
|