Files
movim-rs/frontend/widgets/BottomNavigation/bottomnavigation.js
T
2026-10-24 14:03:52 +07:00

33 lines
972 B
JavaScript

var BottomNavigation = {
chatsCounter: 0,
spacesCounters: {},
setChatNotification: function (keys) {
let counter = document.querySelector('#bottomchatcounter');
if (counter) {
counter.classList.remove('notifications');
Object.keys(keys).forEach(key => {
if (key == 'chat') {
BottomNavigation.chatsCounter = keys[key];
}
if (key.substring(0, 5) == 'space' && !key.includes('|')) {
BottomNavigation.spacesCounters[key] = keys[key];
}
});
if (BottomNavigation.chatsCounter
+ Object.values(BottomNavigation.spacesCounters).reduce((sum, counter) => sum + counter, 0)) {
counter.classList.add('notifications');
}
}
}
}
MovimWebsocket.initiate(() => {
if (MovimUtils.isMobile()) {
BottomNavigation_ajaxHttpRefresh()
}
});