mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Merge branch 'jsEvents'
This commit is contained in:
commit
9a4498c143
@ -16,6 +16,7 @@ TimWolla.WCF ?= {}
|
|||||||
title: document.title
|
title: document.title
|
||||||
messageTemplate: null
|
messageTemplate: null
|
||||||
newMessageCount: null
|
newMessageCount: null
|
||||||
|
events: { newMessage: $.Callbacks() }
|
||||||
init: () ->
|
init: () ->
|
||||||
@bindEvents()
|
@bindEvents()
|
||||||
@refreshRoomList()
|
@refreshRoomList()
|
||||||
@ -175,6 +176,8 @@ TimWolla.WCF ?= {}
|
|||||||
###
|
###
|
||||||
handleMessages: (messages) ->
|
handleMessages: (messages) ->
|
||||||
for message in messages
|
for message in messages
|
||||||
|
@events.newMessage.fire message
|
||||||
|
|
||||||
output = @messageTemplate.fetch message
|
output = @messageTemplate.fetch message
|
||||||
li = $ '<li></li>'
|
li = $ '<li></li>'
|
||||||
li.addClass 'chatMessage chatMessage'+message.type
|
li.addClass 'chatMessage chatMessage'+message.type
|
||||||
|
@ -182,7 +182,9 @@
|
|||||||
animations: {CHAT_ANIMATIONS},
|
animations: {CHAT_ANIMATIONS},
|
||||||
maxTextLength: {CHAT_LENGTH}
|
maxTextLength: {CHAT_LENGTH}
|
||||||
}
|
}
|
||||||
|
{event name='shouldInit'}
|
||||||
TimWolla.WCF.Chat.init();
|
TimWolla.WCF.Chat.init();
|
||||||
|
{event name='didInit'}
|
||||||
TimWolla.WCF.Chat.handleMessages([
|
TimWolla.WCF.Chat.handleMessages([
|
||||||
{implode from=$newestMessages item='message'}
|
{implode from=$newestMessages item='message'}
|
||||||
{@$message->jsonify()}
|
{@$message->jsonify()}
|
||||||
|
Loading…
Reference in New Issue
Block a user