From c1bbf1ea049cda1eafec49958dc00c49b4690b33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 1 Apr 2011 13:25:26 +0200 Subject: [PATCH] Disable buttons after posting, re-enable after the request finished. --- src/main/resources/static/javascript/sone.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 9ef6812..96c8ad5 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -639,6 +639,8 @@ function ajaxifyPost(postElement) { return false; }); $(postElement).find(".create-reply button:submit").click(function() { + button = $(this); + button.attr("disabled", "disabled"); sender = $(this.form).find(":input[name=sender]").val(); inputField = $(this.form).find(":input[name=text]:enabled").get(0); postId = getPostId(this); @@ -655,6 +657,7 @@ function ajaxifyPost(postElement) { } else { alert(error); } + button.removeAttr("disabled"); }); })(sender, postId, text, inputField); return false; @@ -1298,6 +1301,8 @@ $(document).ready(function() { return false; }); $("#sone #update-status").submit(function() { + button = $("button:submit", this); + button.attr("disabled", "disabled"); if ($(this).find(":input.default:enabled").length > 0) { return false; } @@ -1307,6 +1312,7 @@ $(document).ready(function() { if ((data != null) && data.success) { loadNewPost(data.postId, data.sone, data.recipient); } + button.removeAttr("disabled"); }); $(this).find(":input[name=sender]").val(getCurrentSoneId()); $(this).find(":input[name=text]:enabled").val("").blur(); -- 2.7.4