From 45abd9c2c690c31e2c251072f9e7633f02977e22 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 25 Nov 2010 15:03:14 +0100 Subject: [PATCH] Only mark new elements as known. --- src/main/resources/static/javascript/sone.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 0e33c85..3b61e29 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -654,9 +654,11 @@ function loadNewReply(replyId) { function markPostAsKnown(postElements) { $(postElements).each(function() { postElement = this; - $.getJSON("ajax/markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function() { - $(postElement).removeClass("new"); - }); + if ($(postElement).hasClass("new")) { + $.getJSON("ajax/markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) { + $(postElement).removeClass("new"); + }); + } }); markReplyAsKnown($(postElements).find(".reply")); } @@ -664,9 +666,11 @@ function markPostAsKnown(postElements) { function markReplyAsKnown(replyElements) { $(replyElements).each(function() { replyElement = this; - $.getJSON("ajax/markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function() { - $(replyElement).removeClass("new"); - }); + if ($(replyElement).hasClass("new")) { + $.getJSON("ajax/markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function(data, textStatus) { + $(replyElement).removeClass("new"); + }); + } }); } -- 2.7.4