diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml
index 31bcec16c..13e656ce7 100644
--- a/app/views/aspects/index.html.haml
+++ b/app/views/aspects/index.html.haml
@@ -17,7 +17,7 @@
%ul{:class => 'stream', :id => 'main_stream'}
= render 'shared/stream', :posts => @post_hashes
-
+ = will_paginate @posts
.span-8.last
= render 'aspects/all_aspects_contacts'
diff --git a/app/views/aspects/show.html.haml b/app/views/aspects/show.html.haml
index a8b7692e6..b2970c59d 100644
--- a/app/views/aspects/show.html.haml
+++ b/app/views/aspects/show.html.haml
@@ -25,3 +25,4 @@
%ul{:class => 'stream', :id => 'main_stream'}
= render 'shared/stream', :posts => @post_hashes
+ =will_paginate @posts
diff --git a/app/views/shared/_stream.haml b/app/views/shared/_stream.haml
index bf5dbbf6a..b349c3a93 100644
--- a/app/views/shared/_stream.haml
+++ b/app/views/shared/_stream.haml
@@ -3,6 +3,3 @@
-# the COPYRIGHT file.
- for post_hash in posts
= render 'shared/stream_element', post_hash.merge(:aspects => @aspects, :commenting_disabled => defined?(@commenting_disabled))
-
-.pagination
- = will_paginate @posts
diff --git a/config/assets.yml b/config/assets.yml
index 739b08db3..3157383a5 100644
--- a/config/assets.yml
+++ b/config/assets.yml
@@ -11,6 +11,7 @@ javascripts:
- public/javascripts/vendor/jquery.hotkeys.js
- public/javascripts/vendor/jquery.autoresize.min.js
- public/javascripts/vendor/fancybox/jquery.fancybox-1.3.1.pack.js
+ - public/javascripts/vendor/jquery.infinitescroll.min.js
- public/javascripts/vendor/fileuploader.js
- public/javascripts/view.js
- public/javascripts/stream.js
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index c4b61cb4d..ec4d3b51e 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1,7 +1,25 @@
-$(function () {
- $('#main_stream .pagination a').live('click', function () {
- $.getScript(this.href);
- return false;
- }
- );
+//$(function () {
+ //$('#main_stream .pagination a').live('click', function () {
+ //$.getScript(this.href);
+ //return false;
+ //}
+ //);
+//});
+
+// infinitescroll() is called on the element that surrounds
+// the items you will be loading more of
+ $(document).ready(function() {
+$('#main_stream').infinitescroll({
+ navSelector : "div.pagination",
+ // selector for the paged navigation (it will be hidden)
+ nextSelector : ".pagination a.next_page",
+ // selector for the NEXT link (to page 2)
+ itemSelector : "#main_stream",
+ // selector for all items you'll retrieve
+ bufferPx: 300,
+ donetext: "no more.",
+ loadingText: "",
+ loadingImg: 'images/ajax-loader.gif'
+ });
});
+
diff --git a/public/javascripts/vendor/jquery.infinitescroll.min.js b/public/javascripts/vendor/jquery.infinitescroll.min.js
new file mode 100644
index 000000000..c092afa69
--- /dev/null
+++ b/public/javascripts/vendor/jquery.infinitescroll.min.js
@@ -0,0 +1,9 @@
+/*!
+// Infinite Scroll jQuery plugin
+// copyright Paul Irish, licensed GPL & MIT
+// version 1.5.101207
+
+// home and docs: http://www.infinite-scroll.com
+*/
+(function($){$.fn.infinitescroll=function(options,callback){function debug(){if(opts.debug){window.console&&console.log.call(console,arguments)}}function areSelectorsValid(opts){for(var key in opts){if(key.indexOf&&key.indexOf("Selector")>-1&&$(opts[key]).length===0){debug("Your "+key+" found no elements.");return false}return true}}function determinePath(path){if(path.match(/^(.*?)\b2\b(.*?$)/)){path=path.match(/^(.*?)\b2\b(.*?$)/).slice(1)}else{if(path.match(/^(.*?)2(.*?$)/)){if(path.match(/^(.*?page=)2(\/.*|$)/)){path=path.match(/^(.*?page=)2(\/.*|$)/).slice(1);return path}debug("Trying backup next selector parse technique. Treacherous waters here, matey.");path=path.match(/^(.*?)2(.*?$)/).slice(1)}else{if(path.match(/^(.*?page=)1(\/.*|$)/)){path=path.match(/^(.*?page=)1(\/.*|$)/).slice(1);return path}if($.isFunction(opts.pathParse)){return[path]}else{debug("Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.");props.isInvalidPage=true}}}return path}function filterNav(){opts.isFiltered=true;return $(window).trigger("error.infscr."+opts.infid,[302])}function isNearBottom(){var pixelsFromWindowBottomToBottom=0+$(document).height()-($(props.container).scrollTop()||$(props.container.ownerDocument.body).scrollTop())-$(window).height();debug("math:",pixelsFromWindowBottomToBottom,props.pixelsFromNavToBottom);return(pixelsFromWindowBottomToBottom-opts.bufferPx