diff --git a/file/js/TimWolla.WCF.Chat.js b/file/js/TimWolla.WCF.Chat.js index 33e6a04..c3043ee 100644 --- a/file/js/TimWolla.WCF.Chat.js +++ b/file/js/TimWolla.WCF.Chat.js @@ -54,25 +54,24 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {}; }, this)); $('#chatForm').submit($.proxy(function (event) { - // check the input, if not empty send it. + // break if input contains only whitespace if ($('#chatInput').val().trim().length === 0) return false; event.preventDefault(); - textInput = $(event.target).find('#chatInput'); submitButton = $(event.target).find('input[type=image]'); $.ajax('index.php/Chat/Send/', { dataType: 'json', - data: { ajax: 1, - text: textInput.val() - }, + data: { + text: $('#chatInput').val() + }, type: 'POST', beforeSend: $.proxy(function (jqXHR) { submitButton.attr('src', WCF.Icon.get('wcf.icon.loading')); }), success: $.proxy(function (data, textStatus, jqXHR) { this.getMessages(); - textInput.val('').focus(); + $('#chatInput').val('').focus(); }, this), error: function() { // TODO: find a nicer solution.