|
|
|
@ -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 (willBeHidden(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,14 @@ function processLastHave(userHaves)
@@ -266,7 +277,14 @@ 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 (willBeHidden(posts[i])) { |
|
|
|
|
p2h++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_newPostsPending += posts.length - p2h; |
|
|
|
|
if( _newPostsPending ) { |
|
|
|
|
$.MAL.reportNewPosts(_newPostsPending); |
|
|
|
|
} |
|
|
|
@ -288,3 +306,36 @@ function timelineChangedUser()
@@ -288,3 +306,36 @@ function timelineChangedUser()
|
|
|
|
|
_newPostsPending = 0; |
|
|
|
|
timelineLoaded = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function willBeHidden(post){ |
|
|
|
|
var msg = post['userpost']['msg']; |
|
|
|
|
var hidden = false; |
|
|
|
|
|
|
|
|
|
if (post['userpost']['n'] === defaultScreenName) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
if ($.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 )) |
|
|
|
|
{ |
|
|
|
|
hidden = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(post['userpost']['rt']) !== 'undefined' && |
|
|
|
|
$.Options.getHideCloseRTsOpt() != 'disable' && |
|
|
|
|
followingUsers.indexOf(post['userpost']['rt']['n']) > -1 && |
|
|
|
|
parseInt(post['userpost']['time']) - parseInt(post['userpost']['rt']['time']) < $.Options.getHideCloseRTsHourOpt() * 3600) |
|
|
|
|
{ |
|
|
|
|
if (hidden) |
|
|
|
|
return false; |
|
|
|
|
else |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return hidden; |
|
|
|
|
} |