From f056b303f8bfb9a7553321795f9de4d57d266196 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sat, 8 Apr 2017 15:20:28 -0700 Subject: [PATCH] set msg box to readonly on send --- titanembeds/static/js/embed.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/titanembeds/static/js/embed.js b/titanembeds/static/js/embed.js index b6be8e1..7d8eb2c 100644 --- a/titanembeds/static/js/embed.js +++ b/titanembeds/static/js/embed.js @@ -374,6 +374,7 @@ $("#messagebox").keyup(function(event){ if(event.keyCode == 13 && $(this).val().length >= 1 && $(this).val().length <= 350) { $(this).val($.trim($(this).val())); $(this).blur(); + $("#messagebox").attr('readonly', true); var funct = post(selected_channel, $(this).val()); funct.done(function(data) { $("#messagebox").val(""); @@ -388,6 +389,9 @@ $("#messagebox").keyup(function(event){ Materialize.toast('You are sending messages too fast! 1 message per 10 seconds', 10000); } }); + funct.always(function() { + $("#messagebox").attr('readonly', false); + }) } });