X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=7ab0a765dfd0b95b0792b41081530448a286c330;hb=01b0adc620877b3ec8b3eecb075dbba2d0cd9a62;hp=a3e79cd888840e771d827967b5e56d445145e8e8;hpb=68f60579b7f25d7768c1cbb7a60ebb40f306639a;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index a3e79cd..7ab0a76 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -585,7 +585,7 @@ function getStatus() { }); /* process new posts. */ $.each(data.newPosts, function(index, value) { - loadNewPost(value.id, value.sone, value.recipient); + loadNewPost(value.id, value.sone, value.recipient, value.time); }); /* process new replies. */ $.each(data.newReplies, function(index, value) { @@ -706,7 +706,7 @@ function hasReply(replyId) { return $("#sone .reply#" + replyId).length > 0; } -function loadNewPost(postId, soneId, recipientId) { +function loadNewPost(postId, soneId, recipientId, time) { if (hasPost(postId)) { return; } @@ -717,6 +717,9 @@ function loadNewPost(postId, soneId, recipientId) { } } } + if (getPostTime($("#sone .post").last()) > time) { + return; + } $.getJSON("getPost.ajax", { "post" : postId }, function(data, textStatus) { if ((data != null) && data.success) { if (hasPost(data.post.id)) { @@ -859,6 +862,20 @@ function showNotificationDetails(notificationId) { $("#sone .notification#" + notificationId + " .short-text").hide(); } +/** + * Deletes the field with the given ID from the profile. + * + * @param fieldId + * The ID of the field to delete + */ +function deleteProfileField(fieldId) { + $.getJSON("deleteProfileField.ajax", {"formPassword": getFormPassword(), "field": fieldId}, function(data, textStatus) { + if (data && data.success) { + $("#sone .profile-field#" + data.field.id).slideUp(); + } + }); +} + // // EVERYTHING BELOW HERE IS EXECUTED AFTER LOADING THE PAGE //