mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-01-27 23:24:28 +00:00
auto load old posts in profile view
This commit is contained in:
parent
3dc38d6f95
commit
ded234bed7
@ -95,8 +95,12 @@ function requestRTs(postLi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastk,
|
||||||
|
profilePostsLoading = false;
|
||||||
|
|
||||||
function requestPostRecursively(containerToAppend,username,resource,count)
|
function requestPostRecursively(containerToAppend,username,resource,count)
|
||||||
{
|
{
|
||||||
|
profilePostsLoading = true;
|
||||||
dhtget( username, resource, "s",
|
dhtget( username, resource, "s",
|
||||||
function(args, postFromJson) {
|
function(args, postFromJson) {
|
||||||
if( postFromJson ) {
|
if( postFromJson ) {
|
||||||
@ -106,14 +110,16 @@ function requestPostRecursively(containerToAppend,username,resource,count)
|
|||||||
newStreamPost.slideDown("fast");
|
newStreamPost.slideDown("fast");
|
||||||
$.MAL.postboardLoaded();
|
$.MAL.postboardLoaded();
|
||||||
|
|
||||||
if( args.count > 1 ) {
|
var userpost = postFromJson["userpost"];
|
||||||
var userpost = postFromJson["userpost"];
|
var n = userpost["n"];
|
||||||
var n = userpost["n"];
|
lastk = userpost["lastk"];
|
||||||
var lastk = userpost["lastk"];
|
if( lastk == undefined )
|
||||||
if( lastk == undefined )
|
lastk = userpost["k"] - 1; // not true with directmsgs in stream
|
||||||
lastk = userpost["k"] - 1; // not true with directmsgs in stream
|
|
||||||
|
|
||||||
|
if( args.count > 1 ) {
|
||||||
requestPostRecursively(args.containerToAppend, n, "post"+lastk, count-1);
|
requestPostRecursively(args.containerToAppend, n, "post"+lastk, count-1);
|
||||||
|
} else {
|
||||||
|
profilePostsLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {containerToAppend:containerToAppend, count:count} );
|
}, {containerToAppend:containerToAppend, count:count} );
|
||||||
@ -179,7 +185,16 @@ function updateProfileData(profileModalContent, username) {
|
|||||||
|
|
||||||
profileModalContent.find(".following-count").parent().attr("href", $.MAL.followingUrl(username));
|
profileModalContent.find(".following-count").parent().attr("href", $.MAL.followingUrl(username));
|
||||||
|
|
||||||
requestPostRecursively(profileModalContent.find(".postboard-posts"),username,"status",20);
|
var postsView = profileModalContent.find(".postboard-posts");
|
||||||
|
requestPostRecursively(postsView,username,"status",20);
|
||||||
|
postsView.scroll(function(){
|
||||||
|
if (!profilePostsLoading) {
|
||||||
|
var $this = $(this);
|
||||||
|
if ($this.scrollTop() >= this.scrollHeight - $this.height() - 20) {
|
||||||
|
requestPostRecursively($this,username,"post"+lastk,20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFollowingData(followingModalContent, username) {
|
function updateFollowingData(followingModalContent, username) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user