Added comments
This commit is contained in:
@@ -1,49 +1,28 @@
|
||||
var menuFriendsData;
|
||||
var menuGroupsData;
|
||||
var notificationMessagesData;
|
||||
var notificationRequestsData;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Show more friends/users
|
||||
|
||||
// Show more friends
|
||||
// $("#more-friends-click").click(function() {
|
||||
// // Show only friends
|
||||
// $("#groups-menu-section").slideUp();
|
||||
// $("#friends-menu-section li").show();
|
||||
//
|
||||
// // Change buttons
|
||||
// $("#more-friends-click").hide();
|
||||
// $("#menu-back").show();
|
||||
// });
|
||||
//
|
||||
// // Show more groups
|
||||
// $("#more-groups-click").click(function() {
|
||||
// // Show only groups
|
||||
// $("#friends-menu-section").slideUp();
|
||||
// $("#groups-menu-section li").show();
|
||||
//
|
||||
// // Change buttons
|
||||
// $("#more-groups-click").hide();
|
||||
// $("#menu-back").show();
|
||||
// });
|
||||
|
||||
// // Go back
|
||||
// $("#menu-back").click(function() {
|
||||
// // Show overview of friends and groups
|
||||
// $("#friends-menu-section").slideDown();
|
||||
// $("#groups-menu-section").slideDown();
|
||||
// $(".extra-menu-items").hide();
|
||||
//
|
||||
// // Change buttons
|
||||
// $("#menu-back").hide();
|
||||
// $("#more-groups-click").show();
|
||||
// $("#more-friends-click").show();
|
||||
// });
|
||||
|
||||
loadMenuFriends(5);
|
||||
loadNotificationFriends();
|
||||
loadUnreadMessages();
|
||||
loadMenuGroups();
|
||||
setInterval(updateMenus, 3000);
|
||||
});
|
||||
|
||||
|
||||
// Update the menu and notification items.
|
||||
function updateMenus() {
|
||||
loadMenuFriends(5);
|
||||
loadNotificationFriends();
|
||||
loadUnreadMessages();
|
||||
loadMenuGroups();
|
||||
}
|
||||
|
||||
|
||||
// Get, every 3 seconds, the friends and insert them in the menu.
|
||||
function loadMenuFriends(limit) {
|
||||
$.post(
|
||||
"API/loadFriends.php",
|
||||
@@ -51,16 +30,18 @@ function loadMenuFriends(limit) {
|
||||
limit: 5
|
||||
}
|
||||
).done(function(data) {
|
||||
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||
$("#friends-menu-section").show();
|
||||
} else {
|
||||
$("#friends-menu-section").hide();
|
||||
if (menuFriendsData != data) {
|
||||
menuFriendsData = data;
|
||||
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||
$("#friends-menu-section").show();
|
||||
} else {
|
||||
$("#friends-menu-section").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(loadMenuFriends, 3000, limit);
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the groups and insert them in the menu.
|
||||
function loadMenuGroups() {
|
||||
$.post(
|
||||
"API/loadGroups.php",
|
||||
@@ -68,41 +49,45 @@ function loadMenuGroups() {
|
||||
limit: 5
|
||||
}
|
||||
).done(function(data) {
|
||||
if (showGroups(data, "#menu-groups-list")) {
|
||||
$("#groups-menu-section").show();
|
||||
} else {
|
||||
$("#groups-menu-section").hide();
|
||||
if (menuGroupsData != data) {
|
||||
menuGroupsData = data;
|
||||
if (showGroups(data, "#menu-groups-list")) {
|
||||
$("#groups-menu-section").show();
|
||||
} else {
|
||||
$("#groups-menu-section").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(loadMenuGroups, 3000);
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the friends requests and insert them in the notification center.
|
||||
function loadNotificationFriends() {
|
||||
$.post(
|
||||
"API/loadFriendRequest.php"
|
||||
).done(function(data) {
|
||||
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||
$("#friend-request-section").show();
|
||||
} else {
|
||||
$("#friend-request-section").hide();
|
||||
if (notificationRequestsData != data) {
|
||||
notificationRequestsData = data;
|
||||
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||
$("#friend-request-section").show();
|
||||
} else {
|
||||
$("#friend-request-section").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(loadNotificationFriends, 3000);
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the unread messages and insert them in the notification center.
|
||||
function loadUnreadMessages() {
|
||||
$.post(
|
||||
"API/loadChatNotifications.php"
|
||||
).done(function(data) {
|
||||
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||
console.log(data);
|
||||
$("#unread-messages-section").show();
|
||||
} else {
|
||||
$("#unread-messages-section").hide();
|
||||
if (notificationMessagesData != data) {
|
||||
notificationMessagesData = data;
|
||||
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||
$("#unread-messages-section").show();
|
||||
} else {
|
||||
$("#unread-messages-section").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(loadUnreadMessages, 3000);
|
||||
}
|
||||
Reference in New Issue
Block a user