1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Properly support message type CLEAR

This commit is contained in:
Tim Düsterhus 2014-06-19 20:51:48 +02:00
parent 5874065c3c
commit a4c3da02ba

View File

@ -297,8 +297,7 @@ Clear the chat by removing every single message once the clear button is `clicke
$('#timsChatClear').click (event) ->
do event.preventDefault
do $('.timsChatMessageContainer.active .timsChatMessage').remove
$('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop 'scrollHeight'
clearChannel openChannel
Handle toggling of the toggleable buttons.
@ -619,6 +618,10 @@ Insert the given messages into the chat stream.
if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver and lastMessage.isInPrivateChannel is message.isInPrivateChannel
createNewMessage = no
if message.type is v.config.messageTypes.CLEAR
createNewMessage = yes
clearChannel 0
if createNewMessage
message.isFollowUp = no
output = v.messageTemplate.fetch
@ -1013,6 +1016,12 @@ Close private channel
openPrivateChannel 0
Clears a channel
clearChannel = (userID) ->
do $("#timsChatMessageContainer#{userID} .timsChatMessage").remove
$("#timsChatMessageContainer#{userID}").scrollTop $("#timsChatMessageContainer#{userID}").prop 'scrollHeight'
Bind the given callback to the given event.
addListener = (event, callback) ->