1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Don't insert text if the allowed length would be exceeded

This commit is contained in:
Maximilian Mader 2014-04-29 22:04:52 +02:00
parent b633f05452
commit b8bc642714

View File

@ -767,9 +767,13 @@ the existing text. If `options.submit` is true the message will be sent to the s
text = text + $('#timsChatInput').val() if options.prepend text = text + $('#timsChatInput').val() if options.prepend
text = $('#timsChatInput').val() + text if options.append text = $('#timsChatInput').val() + text if options.append
# do not insert text if it would exceed the allowed length
maxLength = $('#timsChatInput').attr 'maxlength'
return if maxLength? and text.length > maxLength
$('#timsChatInput').val text $('#timsChatInput').val text
$('#timsChatInput').trigger 'change' $('#timsChatInput').trigger 'change'
if options.submit if options.submit
do $('#timsChatForm').submit do $('#timsChatForm').submit
else else