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

ChatLeaveAction is now called on unloading

This commit is contained in:
Tim Düsterhus 2012-02-18 17:35:33 +01:00
parent a7e6bab0cd
commit 409c6c068f
2 changed files with 15 additions and 2 deletions

View File

@ -64,6 +64,7 @@ consoleMock ?=
# Binds all the events needed for Tims Chat.
###
bindEvents: () ->
# Mark window as focused
$(window).focus $.proxy () ->
document.title = @titleTemplate.fetch
title: $('#timsChatRoomList .activeMenuItem a').text()
@ -71,10 +72,16 @@ consoleMock ?=
@isActive = true
, @
# Mark window as blurred
$(window).blur $.proxy () ->
@isActive = false
, @
# Unload the chat
$(window).unload $.proxy () ->
@unload()
, @
# Insert a smiley
$('.smiley').click $.proxy (event) ->
@insertText ' ' + $(event.target).attr('alt') + ' '
@ -449,4 +456,11 @@ consoleMock ?=
else
li.addClass 'activeMenuItem'
li.find('.timsChatUserMenu').wcfBlindIn 'vertical'
###
# Unloads the chat.
###
unload: () ->
$.ajax @config.unloadURL,
type: 'POST'
async: false
)(jQuery, @, consoleMock)

View File

@ -186,8 +186,7 @@
// populate config
TimWolla.WCF.Chat.config = {
reloadTime: {@CHAT_RELOADTIME},
animations: {@CHAT_ANIMATIONS},
maxTextLength: {@CHAT_LENGTH}
unloadURL: '{link controller='Chat' action='Leave'}{/link}'
}
WCF.Language.addObject({
'wcf.chat.query': '{lang}wcf.chat.query{/lang}',