diff --git a/public/css/style.less b/public/css/style.less index 5a44a064b0..10d22efd58 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -392,7 +392,7 @@ body .navbar .nodebb-inline-block { #admin-redis-info { span { display:inline-block; - width:200px; + width:220px; } } diff --git a/public/src/forum/admin/users.js b/public/src/forum/admin/users.js index 37204dfbec..436ff79a40 100644 --- a/public/src/forum/admin/users.js +++ b/public/src/forum/admin/users.js @@ -79,8 +79,9 @@ jQuery('document').ready(function() { - var yourid = templates.get('yourid'); - var timeoutId = 0; + var yourid = templates.get('yourid'), + timeoutId = 0, + loadingMoreUsers = false; var url = window.location.href, parts = url.split('/'), @@ -114,8 +115,7 @@ socket.removeAllListeners('api:admin.user.search'); socket.on('api:admin.user.search', function(data) { - - var html = templates.prepare(templates['admin/users'].blocks['users']).parse({ + var html = templates.prepare(templates['admin/users'].blocks['users']).parse({ users: data }), userListEl = document.querySelector('.users'); @@ -139,6 +139,47 @@ initUsers(); }); + function onUsersLoaded(users) { + var html = templates.prepare(templates['admin/users'].blocks['users']).parse({ users: users }), + container = $('#users-container'); + + container.append(html); + } + + function loadMoreUsers() { + var set = ''; + if(active === 'latest') { + set = 'users:joindate'; + } else if(active === 'sort-posts') { + set = 'users:postcount'; + } else if(active === 'sort-reputation') { + set = 'users:reputation'; + } + + if(set) { + loadingMoreUsers = true; + socket.emit('api:users.loadMore', { + set: set, + after: $('#users-container').children().length + }, function(data) { + if(data.users.length) { + onUsersLoaded(data.users); + } + loadingMoreUsers = false; + }); + } + } + + $('#load-more-users-btn').on('click', loadMoreUsers); + + $(window).off('scroll').on('scroll', function() { + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; + + if (document.body.scrollTop > bottom && !loadingMoreUsers) { + loadMoreUsers(); + } + }); + }); - + }()); \ No newline at end of file diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 5720988f74..4c94174488 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -122,10 +122,9 @@ } $(window).off('scroll').on('scroll', function(ev) { - var windowHeight = document.body.offsetHeight - $(window).height(), - half = windowHeight / 2; + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; - if (document.body.scrollTop > half && !loadingMoreTopics) { + if (document.body.scrollTop > bottom && !loadingMoreTopics) { loadMoreTopics(cid); } }); diff --git a/public/src/forum/recent.js b/public/src/forum/recent.js index 44a078a278..1a81ac54fd 100644 --- a/public/src/forum/recent.js +++ b/public/src/forum/recent.js @@ -69,10 +69,9 @@ } $(window).off('scroll').on('scroll', function() { - var windowHeight = document.body.offsetHeight - $(window).height(), - half = windowHeight / 2; + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; - if (document.body.scrollTop > half && !loadingMoreTopics) { + if (document.body.scrollTop > bottom && !loadingMoreTopics) { loadMoreTopics(); } }); diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 2b04f4a2d3..b99a10862d 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -202,10 +202,9 @@ // Infinite scrolling of posts $(window).off('scroll').on('scroll', function() { - var windowHeight = document.body.offsetHeight - $(window).height(), - half = windowHeight / 2; + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; - if (document.body.scrollTop > half && !app.infiniteLoaderActive && $('#post-container').children().length) { + if (document.body.scrollTop > bottom && !app.infiniteLoaderActive && $('#post-container').children().length) { app.loadMorePosts(tid); } }); diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index 8b2342df36..1515ba8966 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -84,10 +84,9 @@ } $(window).off('scroll').on('scroll', function() { - var windowHeight = document.body.offsetHeight - $(window).height(), - half = windowHeight / 2; - - if (document.body.scrollTop > half && !loadingMoreTopics) { + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; + + if (document.body.scrollTop > bottom && !loadingMoreTopics) { loadMoreTopics(); } }); diff --git a/public/src/forum/users.js b/public/src/forum/users.js index 8a56698e5d..6f77d4e5f3 100644 --- a/public/src/forum/users.js +++ b/public/src/forum/users.js @@ -2,6 +2,7 @@ $(document).ready(function() { var timeoutId = 0; + var loadingMoreUsers = false; var url = window.location.href, parts = url.split('/'), @@ -74,6 +75,46 @@ $(element).html(app.addCommas($(element).html())); }); + function onUsersLoaded(users) { + var html = templates.prepare(templates['users'].blocks['users']).parse({ users: users }), + container = $('#users-container'); + + container.append(html); + } + + function loadMoreUsers() { + var set = ''; + if(active === 'users-latest' || active === 'users') { + set = 'users:joindate'; + } else if(active === 'users-sort-posts') { + set = 'users:postcount'; + } else if(active === 'users-sort-reputation') { + set = 'users:reputation'; + } + + if(set) { + loadingMoreUsers = true; + socket.emit('api:users.loadMore', { + set: set, + after: $('#users-container').children().length + }, function(data) { + if(data.users.length) { + onUsersLoaded(data.users); + } + loadingMoreUsers = false; + }); + } + } + + $('#load-more-users-btn').on('click', loadMoreUsers); + + $(window).off('scroll').on('scroll', function() { + var bottom = (document.body.offsetHeight - $(window).height()) * 0.9; + + if (document.body.scrollTop > bottom && !loadingMoreUsers) { + loadMoreUsers(); + } + }); }); }()); \ No newline at end of file diff --git a/public/templates/admin/redis.tpl b/public/templates/admin/redis.tpl index e52f021e02..aa127ef893 100644 --- a/public/templates/admin/redis.tpl +++ b/public/templates/admin/redis.tpl @@ -16,6 +16,7 @@
Total Connections Received {total_connections_received}
Total Commands Processed {total_commands_processed}
+ Instantaneous Ops. Per Second {instantaneous_ops_per_sec}

Keyspace Hits {keyspace_hits}
Keyspace Misses {keyspace_misses}
diff --git a/public/templates/admin/users.tpl b/public/templates/admin/users.tpl index 83fb14d73a..17fa914b12 100644 --- a/public/templates/admin/users.tpl +++ b/public/templates/admin/users.tpl @@ -14,7 +14,7 @@ User not found!
-