1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00
movim_ynh/sources/app/widgets/Menu/menu.js

35 lines
977 B
JavaScript
Raw Normal View History

2016-03-15 16:28:38 +01:00
var Menu = {
refresh: function() {
var items = document.querySelectorAll('#menu_widget ul li, #post_widget ul.card li');
var i = 0;
while(i < items.length)
{
if(items[i].id != 'history') {
items[i].onclick = function(e) {
if(this.dataset.id) {
MovimTpl.showPanel();
Post_ajaxGetPost(this.dataset.id);
//Menu_ajaxGetNode(this.dataset.server, this.dataset.node);
Menu.reset(items);
movim_add_class(this, 'active');
}
}
}
i++;
}
},
reset: function(list) {
for(i = 0; i < list.length; i++) {
movim_remove_class(list[i], 'active');
}
}
}
MovimWebsocket.attach(function() {
Notification_ajaxClear('news');
Notification.current('news');
Menu.refresh();
});