From: David ‘Bombe’ Roden Date: Thu, 9 Dec 2010 05:13:23 +0000 (+0100) Subject: Fix replies being inserted at the wrong posts if the network is sloooooooow. X-Git-Tag: 0.3.2~1 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=10ec5654f69c234c8c3586e592403ac351d0110e;p=Sone.git Fix replies being inserted at the wrong posts if the network is sloooooooow. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index b3b8fdc..acb1d46 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -449,16 +449,18 @@ function ajaxifyPost(postElement) { inputField = $(this.form).find(":input:enabled").get(0); postId = getPostId(this); text = $(inputField).val(); - postReply(postId, text, function(success, error, replyId) { - if (success) { - $(inputField).val(""); - loadNewReply(replyId); - markPostAsKnown(getPostElement(inputField)); - $("#sone .post#" + postId + " .create-reply").addClass("hidden"); - } else { - alert(error); - } - }); + (function(postId, text, inputField) { + postReply(postId, text, function(success, error, replyId) { + if (success) { + $(inputField).val(""); + loadNewReply(replyId); + markPostAsKnown(getPostElement(inputField)); + $("#sone .post#" + postId + " .create-reply").addClass("hidden"); + } else { + alert(error); + } + }); + })(postId, text, inputField); return false; });