aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-11-15 21:22:10 +0000
committerMario <mario@mariovavti.com>2022-11-15 21:22:10 +0000
commitc392a77b46958555bc16592fe4d57e9ab0b7e126 (patch)
treebcb9767aa34814c9199ed42e899e1174d1543afd /view
parent08c2c9bc22b5cffc21e8f7d7ea1cda30c2e1af93 (diff)
downloadvolse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.tar.gz
volse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.tar.bz2
volse-hubzilla-c392a77b46958555bc16592fe4d57e9ab0b7e126.zip
performance: just count the first 99 unseen items and display 99+ if there are more than 99
Diffstat (limited to 'view')
-rw-r--r--view/tpl/notifications_widget.tpl14
1 files changed, 10 insertions, 4 deletions
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 82b3665c3..7a4e909c7 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -306,12 +306,18 @@
if(typeof obj[type] === typeof undefined)
return true;
+ var count = Number(obj[type].count);
+
+
if(obj[type].count) {
$('.' + type + '-button').fadeIn();
- if(replace || followup)
- $('.' + type + '-update').html(Number(obj[type].count));
- else
- $('.' + type + '-update').html(Number(obj[type].count) + Number($('.' + type + '-update').html()));
+ if(replace || followup) {
+ $('.' + type + '-update').html(count >= 100 ? '99+' : count);
+ }
+ else {
+ count = count + Number($('.' + type + '-update').html().replace(/\++$/, ''));
+ $('.' + type + '-update').html(count >= 100 ? '99+' : count);
+ }
}
else {
$('.' + type + '-update').html('0');