1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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) -> $('#timsChatClear').click (event) ->
do event.preventDefault do event.preventDefault
do $('.timsChatMessageContainer.active .timsChatMessage').remove clearChannel openChannel
$('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop 'scrollHeight'
Handle toggling of the toggleable buttons. 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 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 createNewMessage = no
if message.type is v.config.messageTypes.CLEAR
createNewMessage = yes
clearChannel 0
if createNewMessage if createNewMessage
message.isFollowUp = no message.isFollowUp = no
output = v.messageTemplate.fetch output = v.messageTemplate.fetch
@ -1013,6 +1016,12 @@ Close private channel
openPrivateChannel 0 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. Bind the given callback to the given event.
addListener = (event, callback) -> addListener = (event, callback) ->