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

Convert messages to whisper when in private channel

This commit is contained in:
Tim Düsterhus 2013-07-09 21:39:31 +02:00
parent 9bb171b4d9
commit 6c5911d42b

View File

@ -36,6 +36,7 @@ exposed by a function if necessary.
errorVisible = false
lastMessage = null
openChannel = 0
remainingFailures = 3
@ -121,6 +122,9 @@ and afterwards sent to the server by an AJAX request.
return false if text.length is 0
unless openChannel is 0
text = "/whisper #{$("#timsChatMessageContainer#{openChannel}").data 'username'}, #{text}"
# Free the fish!
freeTheFish() if text.toLowerCase() is '/free the fish'
@ -671,18 +675,21 @@ Joins a room.
Open private channel
openPrivateChannel = (userID) ->
$('.timsChatMessageContainer').removeClass 'active'
if !$.wcfIsset "timsChatMessageContainer#{userID}"
return unless $.wcfIsset "timsChatUser#{userID}"
div = $('<div>')
div.attr 'id', "timsChatMessageContainer#{userID}"
div.addClass 'timsChatMessageContainer'
div.addClass 'marginTop'
div.addClass 'container'
div.data 'username', $("#timsChatUser#{userID}").data 'username'
div.wrapInner '<ul>'
$('#timsChatMessageContainer0').after div
$("#timsChatMessageContainer#{userID}").addClass('active')
$('.timsChatMessageContainer').removeClass 'active'
$("#timsChatMessageContainer#{userID}").addClass 'active'
openChannel = userID
Close private channel