diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index a8c1fcd..b7a5c16 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -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) ->