From 0496ba462342943fdaa3a3d7de855339ccff40ae Mon Sep 17 00:00:00 2001 From: erqan Date: Tue, 20 May 2014 16:17:31 +0300 Subject: [PATCH] fixing some setTimeout issues --- js/interface_common.js | 11 ++++++++--- js/twister_following.js | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index 6f9fc2f..c38472e 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -1157,8 +1157,12 @@ var postSubmit = function(e, oldLastPostId) if (e instanceof $) { $this = e; //check if previous part was sent... - if ( oldLastPostId === lastPostId) - setTimeout(postSubmit, 1000, $this, oldLastPostId); + if ( oldLastPostId === lastPostId) { + setTimeout(function () { + postSubmit($this, oldLastPostId); + }, 1000); + return; + } } else { e.stopPropagation(); e.preventDefault(); @@ -1205,8 +1209,9 @@ var postSubmit = function(e, oldLastPostId) $($replyText[0]).remove(); + oldLastPostId = lastPostId; newPostMsg(postxt, $postOrig); - setTimeout(postSubmit, 1000, $this, lastPostId); + setTimeout(function() {postSubmit($this, oldLastPostId);}, 1000); return; } diff --git a/js/twister_following.js b/js/twister_following.js index fd01524..58f0abf 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -390,7 +390,7 @@ function getRandomFollowSuggestion(cbFunc, cbArg) { if ( (i < followingUsers.length && followingUsers[i] == defaultScreenName) || typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') { - setTimeout(getRandomFollowSuggestion, 500, cbFunc, cbArg); + setTimeout(function() {getRandomFollowSuggestion(cbFunc, cbArg);}, 500); return; }