mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-09 00:20:08 +00:00
Adding consoleMock for use in production
This commit is contained in:
parent
29c982e75f
commit
fc7b719920
@ -9,8 +9,11 @@
|
|||||||
|
|
||||||
TimWolla ?= {}
|
TimWolla ?= {}
|
||||||
TimWolla.WCF ?= {}
|
TimWolla.WCF ?= {}
|
||||||
|
consoleMock ?=
|
||||||
|
log: () ->,
|
||||||
|
warn: () ->
|
||||||
|
|
||||||
(($, window) ->
|
(($, window, console) ->
|
||||||
TimWolla.WCF.Chat =
|
TimWolla.WCF.Chat =
|
||||||
# Templates
|
# Templates
|
||||||
titleTemplate: null
|
titleTemplate: null
|
||||||
@ -267,19 +270,19 @@ TimWolla.WCF ?= {}
|
|||||||
# @param array<object> users
|
# @param array<object> users
|
||||||
###
|
###
|
||||||
handleUsers: (users) ->
|
handleUsers: (users) ->
|
||||||
foundUsers = {}
|
foundUsers = { }
|
||||||
for user in users
|
for user in users
|
||||||
id = 'chatUser-'+user.userID
|
id = 'chatUser-'+user.userID
|
||||||
element = $('#'+id)
|
element = $('#'+id)
|
||||||
|
|
||||||
# Move the user to the correct position
|
# Move the user to the correct position
|
||||||
if element[0]
|
if element[0]
|
||||||
console.log '[TimWolla.WCF.Chat] Shifting user ' + user.userID
|
console.log '[TimWolla.WCF.Chat] Moving User: "' + user.username + '"'
|
||||||
element = element.detach()
|
element = element.detach()
|
||||||
$('#chatUserList').append element
|
$('#chatUserList').append element
|
||||||
# Insert the user
|
# Insert the user
|
||||||
else
|
else
|
||||||
console.log '[TimWolla.WCF.Chat] Inserting user ' + user.userID
|
console.log '[TimWolla.WCF.Chat] Inserting User: "' + user.username + '"'
|
||||||
li = $ '<li></li>'
|
li = $ '<li></li>'
|
||||||
li.attr 'id', id
|
li.attr 'id', id
|
||||||
li.addClass 'chatUser'
|
li.addClass 'chatUser'
|
||||||
@ -302,9 +305,12 @@ TimWolla.WCF ?= {}
|
|||||||
|
|
||||||
foundUsers[id] = true
|
foundUsers[id] = true
|
||||||
|
|
||||||
|
# Remove users that were not found
|
||||||
$('.chatUser').each () ->
|
$('.chatUser').each () ->
|
||||||
if typeof foundUsers[$(@).attr('id')] is 'undefined'
|
if typeof foundUsers[$(@).attr('id')] is 'undefined'
|
||||||
$(@).remove()
|
console.log '[TimWolla.WCF.Chat] Removing User: "' + $(@).data('username') + '"'
|
||||||
|
$(@).remove();
|
||||||
|
|
||||||
|
|
||||||
$('#toggleUsers .badge').text(users.length);
|
$('#toggleUsers .badge').text(users.length);
|
||||||
###
|
###
|
||||||
@ -435,4 +441,4 @@ TimWolla.WCF ?= {}
|
|||||||
else
|
else
|
||||||
li.addClass 'activeMenuItem'
|
li.addClass 'activeMenuItem'
|
||||||
li.find('.chatUserMenu').wcfBlindIn 'vertical'
|
li.find('.chatUserMenu').wcfBlindIn 'vertical'
|
||||||
)(jQuery, @)
|
)(jQuery, @, consoleMock)
|
||||||
|
@ -183,7 +183,6 @@
|
|||||||
{include file='chatCopyright'}
|
{include file='chatCopyright'}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{include file='chatJavascriptInclude'}
|
{include file='chatJavascriptInclude'}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
@ -195,9 +194,9 @@
|
|||||||
|
|
||||||
// populate config
|
// populate config
|
||||||
TimWolla.WCF.Chat.config = {
|
TimWolla.WCF.Chat.config = {
|
||||||
reloadTime: {CHAT_RELOADTIME},
|
reloadTime: {@CHAT_RELOADTIME},
|
||||||
animations: {CHAT_ANIMATIONS},
|
animations: {@CHAT_ANIMATIONS},
|
||||||
maxTextLength: {CHAT_LENGTH}
|
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}',
|
||||||
|
Loading…
Reference in New Issue
Block a user