mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Trigger chatInput keyup event on submit and insertText
Also check if appended text would be longer than allowed maximum, if so return and focus chatInput
This commit is contained in:
parent
bc01d0380e
commit
fc16da5acd
@ -160,8 +160,13 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
||||
|
||||
if (options.append) {
|
||||
text = $('#chatInput').val() + text;
|
||||
if(text.length > this.config.maxTextLength) {
|
||||
$('#chatInput').focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
$('#chatInput').val(text);
|
||||
$('#chatInput').trigger('keyup');
|
||||
|
||||
if (options.submit) $('#chatForm').submit();
|
||||
else $('#chatInput').focus();
|
||||
@ -207,7 +212,7 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
||||
success: $.proxy(function (data, textStatus, jqXHR) {
|
||||
this.getMessages();
|
||||
$('#chatInput').val('').focus();
|
||||
$('#chatForm .counter').text(this.config.maxTextLength);
|
||||
$('#chatInput').trigger('keyup');
|
||||
}, this),
|
||||
complete: function() {
|
||||
$('#chatInput').removeClass('ajaxLoad');
|
||||
|
Loading…
Reference in New Issue
Block a user