set msg box to readonly on send

This commit is contained in:
Jeremy Zhang 2017-04-08 15:20:28 -07:00
parent 62189811df
commit f056b303f8

View File

@ -374,6 +374,7 @@ $("#messagebox").keyup(function(event){
if(event.keyCode == 13 && $(this).val().length >= 1 && $(this).val().length <= 350) { if(event.keyCode == 13 && $(this).val().length >= 1 && $(this).val().length <= 350) {
$(this).val($.trim($(this).val())); $(this).val($.trim($(this).val()));
$(this).blur(); $(this).blur();
$("#messagebox").attr('readonly', true);
var funct = post(selected_channel, $(this).val()); var funct = post(selected_channel, $(this).val());
funct.done(function(data) { funct.done(function(data) {
$("#messagebox").val(""); $("#messagebox").val("");
@ -388,6 +389,9 @@ $("#messagebox").keyup(function(event){
Materialize.toast('You are sending messages too fast! 1 message per 10 seconds', 10000); Materialize.toast('You are sending messages too fast! 1 message per 10 seconds', 10000);
} }
}); });
funct.always(function() {
$("#messagebox").attr('readonly', false);
})
} }
}); });