Endless scrolling?

Permalink Browser Info Environment
Hi! Thanks again for the addon, a client of mine asked if it would be possible to add endless scrolling?

Since it already uses AJAX for the pagination, my guess is that it is possible. Can you point me in the right direction what files should I modify?

Thanks in advance. Keep up the good work!

Type: Discussion
Status: New
gd42
View Replies:
sdjmchattie replied on at Permalink Reply
sdjmchattie
Hi,

I don't have the time to make changes like those myself (hence why the add-on is free these days) but I can at least point you in the direction you need.

In the zip that you download, you should have a blocks folder and in there a tumblr_feed folder. Inside that folder is the controller.php which does all the hard work of laying stuff out. Lines 82 to 86 add the pagination to the top of the feed and lines 190 to 194 add it to the bottom of the feed. Since you won't be using page numbers, you might want to strip these and instead replace them with some code at the bottom that leaves a space for new posts to arrive and some sort of trigger of the AJAX (not sure how this works, but I assume you catch the rendering of a div on the screen and trigger the AJAX JavaScript function).

The AJAX that loads the new page (current implementation) would need to be modified to only return the next few posts when the browser scrolls to the bottom. The JavaScript which allows the pages to be turned is in tumblrfeed.js under the js folder and is quite simple. It replaces the main div with a loading GIF and then requests from the server the new posts for the next page. When action_getBlogHTML() in the controller returns the HTML for the next posts, the JavaScript replaces the loading image with the HTML it got back. So you see that the JavaScript triggers the receipt of new posts and the controller produces the HTML. You need to make it so there's a trigger below the bottom of the HTML for the JavaScript and that the JavaScript appends to the HTML, not overwrites it.

It's not an easy task, but perhaps someone with more experience of AJAX with endless scrolling could help now you know where the work is happening.

Best wishes,

Stuart

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.