|
@@ -2,6 +2,27 @@
|
|
Images = new Mongo.Collection("images");
|
|
Images = new Mongo.Collection("images");
|
|
|
|
|
|
if (Meteor.isClient) {
|
|
if (Meteor.isClient) {
|
|
|
|
+ Session.set("imageLimit", 8);
|
|
|
|
+
|
|
|
|
+ let lastScrollTop = 0;
|
|
|
|
+
|
|
|
|
+ $(window).scroll(function (event) {
|
|
|
|
+ let $window = $(window);
|
|
|
|
+
|
|
|
|
+ // Current position in the page.
|
|
|
|
+ let scrollTop = $window.scrollTop();
|
|
|
|
+
|
|
|
|
+ // If we are near the bottom of the window.
|
|
|
|
+ if (scrollTop + $window.height() > $(document).height() - 100) {
|
|
|
|
+ // If we are heading down.
|
|
|
|
+ if (scrollTop > lastScrollTop) {
|
|
|
|
+ Session.set("imageLimit", Session.get("imageLimit") + 4);
|
|
|
|
+ console.log('Increased image count');
|
|
|
|
+ }
|
|
|
|
+ lastScrollTop = scrollTop;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
Accounts.ui.config({
|
|
Accounts.ui.config({
|
|
passwordSignupFields: "USERNAME_AND_EMAIL"
|
|
passwordSignupFields: "USERNAME_AND_EMAIL"
|
|
});
|
|
});
|
|
@@ -15,7 +36,10 @@ if (Meteor.isClient) {
|
|
images: function () {
|
|
images: function () {
|
|
const createdBy = Session.get("userFilter");
|
|
const createdBy = Session.get("userFilter");
|
|
const selector = createdBy ? { createdBy } : {};
|
|
const selector = createdBy ? { createdBy } : {};
|
|
- return Images.find(selector, { sort: { createdOn: -1, rating: -1 }});
|
|
|
|
|
|
+ return Images.find(selector, {
|
|
|
|
+ sort: { createdOn: -1, rating: -1 },
|
|
|
|
+ limit: Session.get("imageLimit")
|
|
|
|
+ });
|
|
},
|
|
},
|
|
filtering_images: function () {
|
|
filtering_images: function () {
|
|
const userFilter = Session.get("userFilter");
|
|
const userFilter = Session.get("userFilter");
|