Merge branch 'master' into hendrik-post

This commit is contained in:
Hendrik
2017-02-01 14:13:55 +01:00
117 changed files with 11735 additions and 414 deletions

View File

@@ -17,12 +17,10 @@ $(window).on("load", function () {
because serialize doesn't take submit values. */
$('#admin-batchform > button').click(function () {
$('#batchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
$('#admin-groupbatchform > button').click(function () {
$('#groupbatchinput').prop('value', $(this).prop('value'));
console.log($('#batchinput').prop('value'));
});
});
@@ -67,7 +65,6 @@ function searchFromOne() {
}
function adminSearch() {
console.log($("#admin-searchform").serialize());
$.post(
"API/adminSearchUsers.php",
$("#admin-searchform").serialize()

View File

@@ -47,7 +47,7 @@ function addMessages(messages) {
var messagesText = "";
for(var i in messages) {
// Initialize message variables
var thisDate = new Date(messages[i].creationdate);
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T"));
var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
var type;
thisDate.setHours(0,0,0,0);
@@ -58,17 +58,15 @@ function addMessages(messages) {
type = "chat-message-other";
}
if (i == 0) {
if (thisDate > previousDate) {
previousDate = thisDate;
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
}
previousDate = thisDate;
messagesText += '\
<div class="day-message"> \
<div class="day-message-content">\
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
</div> \
</div>';
messagesText += '<div class="chat-message"><div class="' + type + '">';
} else if (type != previousType || thisTime != previousTime || thisDate > previousDate) {
} else if (type != previousType || thisTime != previousTime || thisDate.getTime() > previousDate.getTime()) {
messagesText += '<div class="chat-time">\
' + thisTime + '\
</div></div></div>';

View File

@@ -0,0 +1,34 @@
function placeGroupButtons() {
$.post("API/getGrouprole.php", { grp: groupID })
.done(function(data) {
var $buttonContainer = $("div.group-button-container");
if(data == 'none') {
$buttonContainer.append(
"<button class='green group-button' value='request'>" +
"<i class='fa fa-plus'></i> Voeg toe" +
"</button>");
} else if(data == 'request') {
$buttonContainer.append(
"<button class='red group-button' value='none'>" +
"<i class='fa fa-times'></i> Trek verzoek in" +
"</button>");
} else {
$buttonContainer.append(
"<button class='red group-button' value='none'>" +
"<i class='fa fa-times'></i> Verlaat groep" +
"</button>");
}
$buttonContainer.children().click(function() {
$.post("API/editMembership.php", { grp: groupID, role: this.value })
.done(function() {
$buttonContainer.children().remove();
placeGroupButtons();
updateMenus();
}).fail(function() {
});
});
});
}

View File

@@ -1,40 +1,52 @@
$(document).ready(function() {
// Toggle menu
$("#own-profile-picture, #open-notifications").click(function() {
if ($("#notification-center").css('display') == "none") {
// Make the menu visible and move the content to the left.
$(".modal").width("calc(100% - 512px)");
$(".content").css("margin-right", "256px");
$("#notification-center").css("right", "0px");
$("#notification-center").css("display", "block");
$("#contact-menu").css("display", "block");
if ($("#notification-center").css('display') == "none") {
// Make the menu visible and move the content to the left.
$(".modal").width("calc(100% - 512px)");
$(".content").css("margin-right", "256px");
$("#notification-center").css("right", "0px");
$("#notification-center").css("display", "block");
$("#contact-menu").css("display", "block");
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/";
} else {
document.cookie = "menu=closed; path=/";
}
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/";
} else {
$(".modal").width("calc(100% - 256px)");
$(".content").css("margin-right", "0px");
$("#notification-center").css("display", "none");
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 331px)");
} else {
// Make the menu invisible and move the content to the right.
$("#contact-menu").css("display", "none");
}
// Change menu cookie to close
document.cookie = "menu=closed; path=/";
}
} else {
$(".modal").width("calc(100% - 256px)");
$(".content").css("margin-right", "0px");
$("#notification-center").css("display", "none");
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 331px)");
} else {
// Make the menu invisible and move the content to the right.
$("#contact-menu").css("display", "none");
}
// Change menu cookie to close
document.cookie = "menu=closed; path=/";
}
});
if (getCookie("menu") == "open") {
$("#own-profile-picture").click();
// Make the menu visible and move the content to the left.
$(".modal").width("calc(100% - 512px)");
$(".content").css("margin-right", "256px");
$("#notification-center").css("right", "0px");
$("#notification-center").css("display", "block");
$("#contact-menu").css("display", "block");
// Add cookie so the menu stays open on other pages
if (window.innerWidth > 1080) {
$("#chat-history").width("calc(100% - 587px)");
document.cookie = "menu=open; path=/";
} else {
document.cookie = "menu=closed; path=/";
}
}
});

View File

@@ -53,6 +53,7 @@ function editFriendship(userID, value) {
$.post("API/editFriendship.php", { usr: userID, action: value })
.done(function() {
placeFriendButtons();
updateMenus();
});
}

View File

@@ -2,23 +2,28 @@ var menuFriendsData;
var menuGroupsData;
var notificationMessagesData;
var notificationRequestsData;
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();
setInterval(updateMenus, 3000);
setInterval(updateMenus, 10000);
});
// Update the menu and notification items.
function updateMenus() {
loadMenuFriends(5);
loadNotificationFriends();
loadUnreadMessages();
loadMenuGroups();
if (updatingMenus <= 0) {
updatingMenus = 4;
loadMenuFriends(5);
loadNotificationFriends();
loadUnreadMessages();
loadMenuGroups();
}
}
@@ -38,6 +43,7 @@ function loadMenuFriends(limit) {
$("#friends-menu-section").hide();
}
}
updatingMenus --;
});
}
@@ -57,6 +63,7 @@ function loadMenuGroups() {
$("#groups-menu-section").hide();
}
}
updatingMenus --;
});
}
@@ -73,6 +80,7 @@ function loadNotificationFriends() {
$("#friend-request-section").hide();
}
}
updatingMenus --;
});
}
@@ -89,5 +97,6 @@ function loadUnreadMessages() {
$("#unread-messages-section").hide();
}
}
updatingMenus --;
});
}

View File

@@ -1,15 +1,23 @@
function checkLoggedIn() {
if (confirm("U bent al ingelogd!!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
if (confirm("U bent al ingelogd!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
window.location.href = "logout.php";
} else {
window.location.href = "profile.php";
}
}
function emailAlert(){
alert("Bevestigingsemail is gestuurd!\n");
}
function bannedAlert(){
alert("Uw account is geband!");
}
function frozenAlert(){
alert("Uw account is bevroren!\n");
}
function emailNotConfirmed(){
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
}