From 99f8940d38a2c49a054a0d0258f16c649c663d1f Mon Sep 17 00:00:00 2001 From: erqan Date: Sat, 19 Nov 2016 18:31:47 +0300 Subject: [PATCH] fix some silly mistakes --- js/interface_common.js | 8 ++++---- js/twister_following.js | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index ff248b9..05f9c6f 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -783,16 +783,16 @@ function openNewUsersModal() { var hlist = $('
    ') .appendTo(modal.content); - var count = 10; + var count = 15; modal.content.on('scroll', function() { if (modal.content.scrollTop() >= hlist.height() - modal.content.height() - 20) { - !getLastNUsers(5, count, modal.self); - count += 10; + if (getLastNUsers(5, count, modal.self)) + count += 5; } }); - getLastNUsers(10, 0, modal.self); + getLastNUsers(15, 0, modal.self); } function openModalUriShortener() diff --git a/js/twister_following.js b/js/twister_following.js index 98de68e..58d48a9 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -17,6 +17,7 @@ var _lastSearchUsersResultsRemovedFromDHTgetQueue = true; var _lastLoadFromDhtTime = 0; var _lastProcessedBlock = -1; var knownNewUsers = []; +var isNewUserThRunning = false; var twisterFollowingO = undefined; @@ -431,23 +432,34 @@ function followingEmptyOrMyself() { function getLastNUsers(n,offset,module) { + if (isNewUserThRunning) + return false; + + isNewUserThRunning = true; for (var i = offset; i < knownNewUsers.length && i < offset + n; i++) processWhoToFollowSuggestion(module, knownNewUsers[i]); if (knownNewUsers.length >= n + offset) - return; + { + isNewUserThRunning = false; + return true; + } if (_lastProcessedBlock == -1) requestBestBlock(processBlockUsers, {n: n, offset: offset, module: module}); else requestNthBlock(_lastProcessedBlock - 1, processBlockUsers, {n: n, offset: offset, module: module}); + + return true; } function processBlockUsers(block, users){ _lastProcessedBlock = block.height; - if (knownNewUsers.length + block.usernames.length < users.n + users.offset) + if (knownNewUsers.length + block.usernames.length < users.n + users.offset && typeof block.previousblockhash !== 'undefined') setTimeout(function(){requestBlock(block.previousblockhash, processBlockUsers, users);}, 100); + else + isNewUserThRunning = false; for (var i = 0; i < block.usernames.length; i++) { if (knownNewUsers.indexOf(block.usernames[i]) == -1) {