Merge branch 'master' into hendrik-post

This commit is contained in:
Hendrik
2017-01-25 15:59:40 +01:00
35 changed files with 989 additions and 315 deletions

View File

@@ -53,8 +53,8 @@ function switchUser(userID) {
$(".destinationID").val(userID);
$("#chat-history").html("");
$("#lastID").val("");
$(".chat-left .friend-item").removeClass("active-friend-chat");
$(".chat-left #friend-item-" + userID).addClass("active-friend-chat");
$("#chat-recent-panel .friend-item").removeClass("active-friend-chat");
$("#chat-left #friend-item-" + userID).addClass("active-friend-chat");
}
function sayEmpty() {

View File

@@ -1,8 +1,18 @@
function showNotifications(notifications, id) {
$("#" + id).html("");
function showFriendNotifications(notifications) {
$("#friendrequestslist").html("");
for (i in notifications) {
$("#" + id).append(" \
<li class='friend-item $extraItem'> \
var outgoing = "";
if (notifications[i].friend_state == "3") {
outgoing = "<button\
name='accept' \
class='accept-notification' \
value='"+ notifications[i].userID +"'> \
<i class='fa fa-check'></i> \
</button>";
}
$("#friendrequestslist").append(" \
<li class='friend-item'> \
<form action='profile.php' method='get'> \
<button type='submit' \
name='username' \
@@ -13,6 +23,41 @@ function showNotifications(notifications, id) {
</div> \
</button> \
</form> \
<div class='notification-options'>\
<form action='API/edit_friendship.php' method='post'> \
<input type='hidden' name='userID' value='"+ notifications[i].userID +"' /> \
"+ outgoing +" \
<button type='submit' \
name='delete' \
class='deny-notification' \
value='"+ notifications[i].userID +"'> \
<i class='fa fa-times'></i> \
</button>\
<form>\
</div> \
</li> \
");
}
}
function showChatNotifications(notifications) {
$("#unreadChatlist").html("");
for (i in notifications) {
$("#unreadChatlist").append(" \
<li class='friend-item'> \
<form action='chat.php' method='get'> \
<button type='submit' \
name='chatID' \
value='"+ notifications[i].userID +"'> \
<div class='friend'> \
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
<div class='friend-name'> \
"+ notifications[i].name +"<br/> \
<span style='color: #666'>"+ notifications[i].content +"</span> \
</div> \
</div> \
</button> \
</form> \
</li> \
");
}
@@ -23,14 +68,14 @@ function loadNotifications() {
"API/loadFriendRequestNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "friendrequestslist");
showFriendNotifications(JSON.parse(data));
}
});
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "unreadChatlist");
showChatNotifications(JSON.parse(data));
}
});

View File

@@ -4,5 +4,12 @@ function checkLoggedIn() {
} else {
window.location.href = "profile.php";
}
document.getElementById("demo").innerHTML = x;
}
function bannedAlert(){
alert("Your account is banned");
}
function emailNotConfirmed(){
alert("Your account has not been verified yet!\nAnother email has been sent to you")
}