Hendrik search #181
@@ -11,7 +11,8 @@ $(document).ready(function() {
|
||||
|
||||
// Add cookie so the menu stays open on other pages
|
||||
if (window.innerWidth > 1080) {
|
||||
$("#chat-history").width("calc(100% - 587px)");
|
||||
$("#chat-history").css("margin-right", "266px");
|
||||
$("#chat-history").css("width", "calc(100% - 512px - 75px)");
|
||||
document.cookie = "menu=open; path=/";
|
||||
} else {
|
||||
document.cookie = "menu=closed; path=/";
|
||||
@@ -22,7 +23,8 @@ $(document).ready(function() {
|
||||
$("#notification-center").css("display", "none");
|
||||
|
||||
if (window.innerWidth > 1080) {
|
||||
$("#chat-history").width("calc(100% - 331px)");
|
||||
$("#chat-history").css("margin-right", "10px");
|
||||
$("#chat-history").css("width", "calc(100% - 256px - 85px)");
|
||||
} else {
|
||||
// Make the menu invisible and move the content to the right.
|
||||
$("#contact-menu").css("display", "none");
|
||||
@@ -43,6 +45,7 @@ $(document).ready(function() {
|
||||
|
||||
// Add cookie so the menu stays open on other pages
|
||||
if (window.innerWidth > 1080) {
|
||||
$("#chat-history").css("margin-right", "266px");
|
||||
$("#chat-history").width("calc(100% - 587px)");
|
||||
document.cookie = "menu=open; path=/";
|
||||
} else {
|
||||
|
||||
@@ -94,14 +94,4 @@ function showGroups(groups, list) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("body").delegate("textarea[maxlength]", "keydown", function() {
|
||||
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
|
||||
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
|
||||
} else {
|
||||
$(this).next().text("");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -6,11 +6,7 @@ var updatingMenus = 0;
|
||||
|
||||
// On document load, load menus and loops loading menus every 10 seconds.
|
||||
$(document).ready(function() {
|
||||
updatingMenus = 4;
|
||||
loadMenuFriends(5);
|
||||
loadNotificationFriends();
|
||||
loadUnreadMessages();
|
||||
loadMenuGroups();
|
||||
updateMenus();
|
||||
setInterval(updateMenus, 10000);
|
||||
});
|
||||
|
||||
@@ -18,7 +14,6 @@ $(document).ready(function() {
|
||||
// Update the menu and notification items.
|
||||
function updateMenus() {
|
||||
if (updatingMenus <= 0) {
|
||||
updatingMenus = 4;
|
||||
loadMenuFriends(5);
|
||||
loadNotificationFriends();
|
||||
loadUnreadMessages();
|
||||
@@ -27,76 +22,105 @@ function updateMenus() {
|
||||
}
|
||||
|
||||
|
||||
// Get, every 3 seconds, the friends and insert them in the menu.
|
||||
// Get the friends and insert them in the menu.
|
||||
function loadMenuFriends(limit) {
|
||||
updatingMenus ++;
|
||||
$.post(
|
||||
"API/loadFriends.php",
|
||||
{
|
||||
limit: 5
|
||||
}
|
||||
).done(function(data) {
|
||||
if (data == "" || data == "[]") {
|
||||
$("#friends-menu-section").hide();
|
||||
} else {
|
||||
$("#friends-menu-section").show();
|
||||
}
|
||||
if (menuFriendsData != data) {
|
||||
menuFriendsData = data;
|
||||
if (showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||
$("#friends-menu-section").show();
|
||||
} else {
|
||||
if (!showFriends(data, "#menu-friends-list", 5, "profile.php", "GET", limit)) {
|
||||
$("#friends-menu-section").hide();
|
||||
}
|
||||
}
|
||||
}).fail(function() {
|
||||
$("#friends-menu-section").hide();
|
||||
}).always(function() {
|
||||
updatingMenus --;
|
||||
});
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the groups and insert them in the menu.
|
||||
// Get the groups and insert them in the menu.
|
||||
function loadMenuGroups() {
|
||||
updatingMenus ++;
|
||||
$.post(
|
||||
"API/loadGroups.php",
|
||||
{
|
||||
limit: 5
|
||||
}
|
||||
).done(function(data) {
|
||||
|
||||
if (data == "" || data == "[]") {
|
||||
$("#groups-menu-section").hide();
|
||||
} else {
|
||||
$("#groups-menu-section").show();
|
||||
}
|
||||
if (menuGroupsData != data) {
|
||||
menuGroupsData = data;
|
||||
if (showGroups(data, "#menu-groups-list")) {
|
||||
$("#groups-menu-section").show();
|
||||
} else {
|
||||
if (!showGroups(data, "#menu-groups-list")) {
|
||||
$("#groups-menu-section").hide();
|
||||
}
|
||||
}
|
||||
}).fail(function() {
|
||||
$("#groups-menu-section").hide();
|
||||
}).always(function() {
|
||||
updatingMenus --;
|
||||
});
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the friends requests and insert them in the notification center.
|
||||
// Get the friends requests and insert them in the notification center.
|
||||
function loadNotificationFriends() {
|
||||
updatingMenus ++;
|
||||
$.post(
|
||||
"API/loadFriendRequest.php"
|
||||
).done(function(data) {
|
||||
if (data == "" || data == "[]") {
|
||||
$("#friend-request-section").hide();
|
||||
} else {
|
||||
$("#friend-request-section").show();
|
||||
}
|
||||
if (notificationRequestsData != data) {
|
||||
notificationRequestsData = data;
|
||||
if (showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||
$("#friend-request-section").show();
|
||||
} else {
|
||||
if (!showFriendsPlus(data, "#friend-requests-list", 5, "profile.php", "GET")) {
|
||||
$("#friend-request-section").hide();
|
||||
}
|
||||
}
|
||||
}).fail(function() {
|
||||
$("#friend-request-section").hide();
|
||||
}).always(function() {
|
||||
updatingMenus --;
|
||||
});
|
||||
}
|
||||
|
||||
// Get, every 3 seconds, the unread messages and insert them in the notification center.
|
||||
// Get the unread messages and insert them in the notification center.
|
||||
function loadUnreadMessages() {
|
||||
updatingMenus ++;
|
||||
$.post(
|
||||
"API/loadChatNotifications.php"
|
||||
).done(function(data) {
|
||||
if (data == "" || data == "[]") {
|
||||
$("#unread-messages-section").hide();
|
||||
} else {
|
||||
$("#unread-messages-section").show();
|
||||
}
|
||||
if (notificationMessagesData != data) {
|
||||
notificationMessagesData = data;
|
||||
if (showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||
$("#unread-messages-section").show();
|
||||
} else {
|
||||
if (!showFriendsPlus(data, "#unread-chat-list", 5, "chat.php", "GET")) {
|
||||
$("#unread-messages-section").hide();
|
||||
}
|
||||
}
|
||||
}).fail(function() {
|
||||
$("#unread-messages-section").hide();
|
||||
}).always(function() {
|
||||
updatingMenus --;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user