diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index d2cb605..7bd749c 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -9,12 +9,18 @@ TimWolla ?= {} TimWolla.WCF ?= {} +consoleMock = console consoleMock ?= log: () ->, - warn: () -> + warn: () ->, + error: () -> (($, window, console) -> TimWolla.WCF.Chat = + # Tims Chat stops loading when this reaches zero + # TODO: We need an explosion animation + shields: 3 + # Templates titleTemplate: null messageTemplate: null @@ -34,17 +40,21 @@ consoleMock ?= events: newMessage: $.Callbacks() userMenu: $.Callbacks() + pe: + getMessages: null + refreshRoomList: null + fish: null init: () -> console.log '[TimWolla.WCF.Chat] Initializing' @bindEvents() @events.newMessage.add $.proxy @notify, @ - new WCF.PeriodicalExecuter $.proxy(@refreshRoomList, @), 60e3 - new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1e3 + @pe.refreshRoomList = new WCF.PeriodicalExecuter $.proxy(@refreshRoomList, @), 60e3 + @pe.getMessages = new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1e3 @refreshRoomList() @getMessages() - console.log '[TimWolla.WCF.Chat] Finished initializing' + console.log '[TimWolla.WCF.Chat] Finished initializing - Shields at 104 percent' ### # Autocompletes a username ### @@ -206,7 +216,7 @@ consoleMock ?= # Frees the fish ### freeTheFish: () -> - return if $.wcfIsset('fish') + return if $.wcfIsset 'fish' console.warn '[TimWolla.WCF.Chat] Freeing the fish' fish = $ '