From: David ‘Bombe’ Roden Date: Thu, 25 Nov 2010 14:50:26 +0000 (+0100) Subject: Create new scopes to not lose the element we’re unmarking. X-Git-Tag: 0.3.1-RC1~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=95789c708a5c886410e860e72c7fca0c7f21cb17;p=Sone.git Create new scopes to not lose the element we’re unmarking. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 32ad683..e7d19e6 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -659,9 +659,11 @@ 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"); - }); + (function(postElement) { + $.getJSON("ajax/markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) { + $(postElement).removeClass("new"); + }); + })(postElement); } }); markReplyAsKnown($(postElements).find(".reply")); @@ -671,9 +673,11 @@ 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"); - }); + (function(replyElement) { + $.getJSON("ajax/markReplyAsKnown.ajax", {"formPassword": getFormPassword(), "reply": getReplyId(replyElement)}, function(data, textStatus) { + $(replyElement).removeClass("new"); + }); + })(replyElement); } }); }