|
|
|
@ -140,8 +140,15 @@ function requestGetposts(req)
@@ -140,8 +140,15 @@ function requestGetposts(req)
|
|
|
|
|
// request if needed
|
|
|
|
|
function processReceivedPosts(req, posts) |
|
|
|
|
{ |
|
|
|
|
//hiding posts can cause empty postboard, so we have to track the count...
|
|
|
|
|
var p2a = posts.length; |
|
|
|
|
for( var i = 0; i < posts.length; i++ ) { |
|
|
|
|
var post = posts[i]; |
|
|
|
|
if (willBeHiden(post)) { |
|
|
|
|
p2a--; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var streamPost = postToElem(post, "original"); |
|
|
|
|
var timePost = post["userpost"]["time"]; |
|
|
|
|
streamPost.attr("data-time",timePost); |
|
|
|
@ -192,11 +199,15 @@ function processReceivedPosts(req, posts)
@@ -192,11 +199,15 @@ function processReceivedPosts(req, posts)
|
|
|
|
|
} |
|
|
|
|
req.doneReportProcessing(posts.length); |
|
|
|
|
|
|
|
|
|
if( req.mode == "done" ) { |
|
|
|
|
//if the count of posts less then 5....
|
|
|
|
|
if( req.mode == "done" && p2a > 5) { |
|
|
|
|
timelineLoaded = true; |
|
|
|
|
$.MAL.postboardLoaded(); |
|
|
|
|
_refreshInProgress = false; |
|
|
|
|
} else { |
|
|
|
|
//we will request more older post...
|
|
|
|
|
req.count += postsPerRefresh; |
|
|
|
|
req.mode = 'older'; |
|
|
|
|
requestGetposts(req); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -266,7 +277,15 @@ function processLastHave(userHaves)
@@ -266,7 +277,15 @@ function processLastHave(userHaves)
|
|
|
|
|
// callback for getposts to update the number of new pending posts not shown in timeline
|
|
|
|
|
function processNewPostsConfirmation(expected, posts) |
|
|
|
|
{ |
|
|
|
|
_newPostsPending += posts.length; |
|
|
|
|
//we don't want to produce alert for the posts that won't be displayed
|
|
|
|
|
var p2h = 0; |
|
|
|
|
for( var i = posts.length-1; i >= 0; i-- ) { |
|
|
|
|
if (willBeHiden(posts[i])) { |
|
|
|
|
//posts.splice(i, 1);
|
|
|
|
|
p2h++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_newPostsPending += posts.length - p2h; |
|
|
|
|
if( _newPostsPending ) { |
|
|
|
|
$.MAL.reportNewPosts(_newPostsPending); |
|
|
|
|
} |
|
|
|
@ -288,3 +307,20 @@ function timelineChangedUser()
@@ -288,3 +307,20 @@ function timelineChangedUser()
|
|
|
|
|
_newPostsPending = 0; |
|
|
|
|
timelineLoaded = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function willBeHiden(post){ |
|
|
|
|
var msg = post['userpost']['msg']; |
|
|
|
|
if (post['userpost']['n'] !== defaultScreenName && |
|
|
|
|
$.Options.getHideRepliesOpt() !== 'disable' && |
|
|
|
|
/^\@/.test(msg) && |
|
|
|
|
!(new RegExp('@' + defaultScreenName + '( |,|;|\\.|:|\\/|\\?|\\!|\\\\|\'|"|\\n|$)').test(msg))) |
|
|
|
|
{ |
|
|
|
|
if ($.Options.getHideRepliesOpt() === 'only-me' || |
|
|
|
|
($.Options.getHideRepliesOpt() === 'following' && |
|
|
|
|
followingUsers.indexOf(msg.substring(1, msg.search(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n/))) === -1 )) |
|
|
|
|
{ |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |