fix some silly mistakes

This commit is contained in:
erqan 2016-11-19 18:31:47 +03:00
parent c188e6d134
commit 99f8940d38
2 changed files with 18 additions and 6 deletions

View File

@ -783,16 +783,16 @@ function openNewUsersModal() {
var hlist = $('<ol class="follow-suggestions"></ol>') var hlist = $('<ol class="follow-suggestions"></ol>')
.appendTo(modal.content); .appendTo(modal.content);
var count = 10; var count = 15;
modal.content.on('scroll', function() { modal.content.on('scroll', function() {
if (modal.content.scrollTop() >= hlist.height() - modal.content.height() - 20) { if (modal.content.scrollTop() >= hlist.height() - modal.content.height() - 20) {
!getLastNUsers(5, count, modal.self); if (getLastNUsers(5, count, modal.self))
count += 10; count += 5;
} }
}); });
getLastNUsers(10, 0, modal.self); getLastNUsers(15, 0, modal.self);
} }
function openModalUriShortener() function openModalUriShortener()

View File

@ -17,6 +17,7 @@ var _lastSearchUsersResultsRemovedFromDHTgetQueue = true;
var _lastLoadFromDhtTime = 0; var _lastLoadFromDhtTime = 0;
var _lastProcessedBlock = -1; var _lastProcessedBlock = -1;
var knownNewUsers = []; var knownNewUsers = [];
var isNewUserThRunning = false;
var twisterFollowingO = undefined; var twisterFollowingO = undefined;
@ -431,23 +432,34 @@ function followingEmptyOrMyself() {
function getLastNUsers(n,offset,module) { function getLastNUsers(n,offset,module) {
if (isNewUserThRunning)
return false;
isNewUserThRunning = true;
for (var i = offset; i < knownNewUsers.length && i < offset + n; i++) for (var i = offset; i < knownNewUsers.length && i < offset + n; i++)
processWhoToFollowSuggestion(module, knownNewUsers[i]); processWhoToFollowSuggestion(module, knownNewUsers[i]);
if (knownNewUsers.length >= n + offset) if (knownNewUsers.length >= n + offset)
return; {
isNewUserThRunning = false;
return true;
}
if (_lastProcessedBlock == -1) if (_lastProcessedBlock == -1)
requestBestBlock(processBlockUsers, {n: n, offset: offset, module: module}); requestBestBlock(processBlockUsers, {n: n, offset: offset, module: module});
else else
requestNthBlock(_lastProcessedBlock - 1, processBlockUsers, {n: n, offset: offset, module: module}); requestNthBlock(_lastProcessedBlock - 1, processBlockUsers, {n: n, offset: offset, module: module});
return true;
} }
function processBlockUsers(block, users){ function processBlockUsers(block, users){
_lastProcessedBlock = block.height; _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); setTimeout(function(){requestBlock(block.previousblockhash, processBlockUsers, users);}, 100);
else
isNewUserThRunning = false;
for (var i = 0; i < block.usernames.length; i++) { for (var i = 0; i < block.usernames.length; i++) {
if (knownNewUsers.indexOf(block.usernames[i]) == -1) { if (knownNewUsers.indexOf(block.usernames[i]) == -1) {