diff options
author | Mario <mario@mariovavti.com> | 2022-11-15 21:22:10 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-11-15 21:22:10 +0000 |
commit | c392a77b46958555bc16592fe4d57e9ab0b7e126 (patch) | |
tree | bcb9767aa34814c9199ed42e899e1174d1543afd /view/tpl/notifications_widget.tpl | |
parent | 08c2c9bc22b5cffc21e8f7d7ea1cda30c2e1af93 (diff) | |
download | volse-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/tpl/notifications_widget.tpl')
-rw-r--r-- | view/tpl/notifications_widget.tpl | 14 |
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'); |