Added comments to javascript code.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Show the right friendship buttonsto the user.
|
||||
function placeFriendButtons() {
|
||||
$.post("API/getFriendshipStatus.php", { usr: userID })
|
||||
.done(function(data) {
|
||||
//save the friendship status
|
||||
var friendshipStatus = data;
|
||||
var $buttonContainer = $("div.friend-button-container");
|
||||
$("#start-profile-chat").hide();
|
||||
@@ -22,6 +24,7 @@ function placeFriendButtons() {
|
||||
text1 = "Bevriend";
|
||||
icon1 = "fa-handshake-o";
|
||||
break;
|
||||
// Users are friends.
|
||||
case "1":
|
||||
value1 = userID;
|
||||
class1 = "green";
|
||||
@@ -32,12 +35,14 @@ function placeFriendButtons() {
|
||||
text2 = "Verwijder";
|
||||
icon2 = "fa-times";
|
||||
break;
|
||||
// This user sent request.
|
||||
case "2":
|
||||
value1 = "delete";
|
||||
class1 = "red";
|
||||
text1 = "Trek verzoek in";
|
||||
icon1 = "fa-cross";
|
||||
break;
|
||||
// Other user sent request.
|
||||
case "3":
|
||||
value1 = "accept";
|
||||
class1 = "green";
|
||||
@@ -50,6 +55,7 @@ function placeFriendButtons() {
|
||||
break;
|
||||
}
|
||||
|
||||
// Append buttons to the container.
|
||||
$buttonContainer.append(
|
||||
"<button class='"+ class1 +" friend-button' value='"+ value1 +"'>" +
|
||||
"<i class='fa "+ icon1 +"'></i> " + text1 +
|
||||
@@ -59,7 +65,7 @@ function placeFriendButtons() {
|
||||
"<i class='fa "+ icon2 +"'></i> " + text2 +
|
||||
"</button>");
|
||||
|
||||
|
||||
// Gets triggered when a friend button is triggered.
|
||||
$buttonContainer.children().click(function() {
|
||||
if (isNaN(this.value))
|
||||
editFriendship(userID, this.value);
|
||||
|
||||
Reference in New Issue
Block a user