}
function getPostTime(element) {
- return getPostElement(element).find(".storage-time").text();
+ return getPostElement(element).find(".post-time").text();
}
function getReplyElement(element) {
}
function getReplyTime(element) {
- return getReplyElement(element).find(".storage-time").text();
+ return getReplyElement(element).find(".reply-time").text();
}
function likePost(postId) {
postReply(postId, text, function(success, error, replyId) {
if (success) {
loadNewReply(replyId);
+ markPostAsKnown(getPostElement(inputField));
$("#sone .post#" + postId + " .create-reply").addClass("hidden");
} else {
alert(error);
});
newReply = $(data.reply.html).addClass("hidden");
if (firstNewerReply != null) {
- newReply.insertAfter(firstNewerReply);
+ newReply.insertBefore(firstNewerReply);
} else {
if ($(this).find(".replies .create-reply")) {
$(this).find(".replies .create-reply").before(newReply);
});
}
+function markPostAsKnown(postElements) {
+ $(postElements).each(function() {
+ postElement = this;
+ if ($(postElement).hasClass("new")) {
+ $.getJSON("ajax/markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) {
+ $(postElement).removeClass("new");
+ });
+ }
+ });
+ markReplyAsKnown($(postElements).find(".reply"));
+}
+
+function markReplyAsKnown(replyElements) {
+ $(replyElements).each(function() {
+ replyElement = this;
+ if ($(replyElement).hasClass("new")) {
+ $.getJSON("ajax/markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function(data, textStatus) {
+ $(replyElement).removeClass("new");
+ });
+ }
+ });
+}
+
/**
* Creates a new notification.
*