aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-18 09:47:46 +0000
committerMario <mario@mariovavti.com>2020-10-18 09:47:46 +0000
commitff8c9cfd1485c2bc96e6fe59c744908ea48af522 (patch)
treef7f58f26b19ff1ea8db1d79793fbae592e49d90d
parentb5b033fe22fc8c6a8b8342a93a13bc3ab3fc7473 (diff)
downloadvolse-hubzilla-ff8c9cfd1485c2bc96e6fe59c744908ea48af522.tar.gz
volse-hubzilla-ff8c9cfd1485c2bc96e6fe59c744908ea48af522.tar.bz2
volse-hubzilla-ff8c9cfd1485c2bc96e6fe59c744908ea48af522.zip
load more notifications if visible notifications count becomes < 15
-rw-r--r--view/js/main.js16
1 files changed, 14 insertions, 2 deletions
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();
}
+
}