1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-01 14:20:07 +00:00
Tims-Chat/file/js/be.bastelstu.WCF.Chat.Log.coffee

36 lines
1.1 KiB
CoffeeScript
Raw Normal View History

2012-11-23 19:42:05 +00:00
###
# be.bastelstu.WCF.Chat.Log
#
# @author Tim Düsterhus
2013-01-19 19:36:40 +00:00
# @copyright 2010-2013 Tim Düsterhus
2012-11-23 19:42:05 +00:00
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
2013-01-19 19:36:40 +00:00
# @package be.bastelstu.chat
2012-11-23 19:42:05 +00:00
###
2013-01-09 18:59:32 +00:00
(($, window) ->
2013-01-19 19:36:40 +00:00
be.bastelstu.WCF.Chat.Log = be.bastelstu.Chat.extend
2013-01-09 18:59:32 +00:00
init: (@chat) ->
2012-11-23 19:42:05 +00:00
handleMessages: (messages) ->
# Insert the messages
for message in messages
2013-01-09 18:59:32 +00:00
@events.newMessage.fire message
2012-11-23 19:42:05 +00:00
2013-01-09 18:59:32 +00:00
output = @chat.messageTemplate.fetch message
2012-11-23 19:42:05 +00:00
li = $ '<li></li>'
li.addClass 'timsChatMessage timsChatMessage'+message.type
2013-01-09 18:59:32 +00:00
li.addClass 'ownMessage' if message.sender is WCF.User.userID
2012-11-23 19:42:05 +00:00
li.append output
2013-01-09 18:59:32 +00:00
li.appendTo $ '#timsChatLog .timsChatMessageContainer > ul'
2012-11-23 19:42:05 +00:00
2013-01-09 18:59:32 +00:00
be.bastelstu.WCF.Chat.Log.loadOverlay = () ->
if !$.wcfIsset 'timsChatLogDialog'
container = $ '<fieldset id="timsChatLogDialog"></fieldset>'
$('#content').append container
2013-01-19 19:36:40 +00:00
# TODO: Proper path
2013-01-09 18:59:32 +00:00
$('#timsChatLogDialog').load 'http://127.0.0.1/wbb/wbb4/index.php/Chat/Log/1-Hauptchat/', () ->
WCF.showDialog 'timsChatLogDialog',
title: 'Log'
)(jQuery, @)