From ff8c9cfd1485c2bc96e6fe59c744908ea48af522 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 18 Oct 2020 09:47:46 +0000 Subject: load more notifications if visible notifications count becomes < 15 --- view/js/main.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'view/js') diff --git a/view/js/main.js b/view/js/main.js index dbaa9a360..041ecdd43 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1805,14 +1805,16 @@ function sse_bs_notifications(e, replace, followup) { var cn_val = (($('#cn-' + sse_type + '-input').length && sse_partial_result) ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : ''); + $("#nav-" + sse_type + "-loading").show(); + $.get('/sse_bs/' + sse_type + '/' + sse_offset + '?nquery=' + encodeURIComponent(cn_val), function(obj) { console.log('sse: bootstraping ' + sse_type); console.log(obj); sse_bs_active = false; sse_offset = obj[sse_type].offset; - if(sse_offset < 0) - $("#nav-" + sse_type + "-loading").hide(); + + $("#nav-" + sse_type + "-loading").hide(); sse_handleNotifications(obj, replace, followup); @@ -1864,6 +1866,15 @@ function sse_handleNotifications(obj, replace, followup) { }); } + // load more notifications if visible notifications count becomes < 15 + if(sse_type) { + if($('#nav-' + sse_type + '-menu').children().length < 15) { + if(!sse_bs_active) { + sse_bs_notifications(sse_type, false, true); + } + } + } + } function sse_handleNotificationsItems(notifyType, data, replace, followup) { @@ -1978,4 +1989,5 @@ function sse_setNotificationsStatus() { $('#no_notifications').show(); $('#notifications').hide(); } + } -- cgit v1.2.3