1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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. # Binds all the events needed for Tims Chat.
### ###
bindEvents: () -> bindEvents: () ->
# Mark window as focused
$(window).focus $.proxy () -> $(window).focus $.proxy () ->
document.title = @titleTemplate.fetch document.title = @titleTemplate.fetch
title: $('#timsChatRoomList .activeMenuItem a').text() title: $('#timsChatRoomList .activeMenuItem a').text()
@ -71,10 +72,16 @@ consoleMock ?=
@isActive = true @isActive = true
, @ , @
# Mark window as blurred
$(window).blur $.proxy () -> $(window).blur $.proxy () ->
@isActive = false @isActive = false
, @ , @
# Unload the chat
$(window).unload $.proxy () ->
@unload()
, @
# Insert a smiley # Insert a smiley
$('.smiley').click $.proxy (event) -> $('.smiley').click $.proxy (event) ->
@insertText ' ' + $(event.target).attr('alt') + ' ' @insertText ' ' + $(event.target).attr('alt') + ' '
@ -449,4 +456,11 @@ consoleMock ?=
else else
li.addClass 'activeMenuItem' li.addClass 'activeMenuItem'
li.find('.timsChatUserMenu').wcfBlindIn 'vertical' li.find('.timsChatUserMenu').wcfBlindIn 'vertical'
###
# Unloads the chat.
###
unload: () ->
$.ajax @config.unloadURL,
type: 'POST'
async: false
)(jQuery, @, consoleMock) )(jQuery, @, consoleMock)

View File

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