diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index fc0d442..ced68e3 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -23,8 +23,8 @@ TimWolla.WCF ?= {} console.log('[TimWolla.WCF.Chat] Initializing'); @bindEvents() @refreshRoomList() - new WCF.PeriodicalExecuter $.proxy(@refreshRoomList, this), 60e3 - new WCF.PeriodicalExecuter $.proxy(@getMessages, this), @config.reloadTime * 1000 + new WCF.PeriodicalExecuter $.proxy(@refreshRoomList, @), 60e3 + new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1000 @getMessages() console.log '[TimWolla.WCF.Chat] Finished initializing' @@ -38,26 +38,26 @@ TimWolla.WCF ?= {} @newMessageCount = 0 clearTimeout @timeout @isActive = true - , this + , @ $(window).blur $.proxy () -> @title = document.title @isActive = false - , this + , @ $('.smiley').click $.proxy (event) -> @insertText ' ' + $(event.target).attr('alt') + ' ' - , this + , @ $('.chatSidebarTabs li').click $.proxy (event) -> event.preventDefault() @toggleSidebarContents $ event.target - , this + , @ $('#chatForm').submit $.proxy (event) -> event.preventDefault() @submit $ event.target - , this + , @ $('#chatClear').click (event) -> event.preventDefault() @@ -65,7 +65,7 @@ TimWolla.WCF ?= {} $('#chatInput').focus() $('.chatToggle').click (event) -> - element = $ this + element = $ @ icon = element.find 'img' if element.data('status') is 1 element.data 'status', 0 @@ -101,13 +101,14 @@ TimWolla.WCF ?= {} return if $('#topic').text().trim() is '' $('#topic').wcfBlindOut 'vertical', () -> - $(this).text '' + $(@).text '' else $('#topic').text data.topic $('#topic').wcfBlindIn() if $('#topic').text().trim() isnt '' and $('#topic').is(':hidden') $('title').text @titleTemplate.fetch(data) - , this) + @getMessages() + , @) error: () -> # reload page to change the room the old fashion-way # inclusive the error-message :) @@ -117,7 +118,7 @@ TimWolla.WCF ?= {} @loading = true target.parent().addClass 'ajaxLoad' - , this) + , @) ### # Frees the fish ### @@ -165,11 +166,11 @@ TimWolla.WCF ?= {} document.title = @newMessageCount + WCF.Language.get('wcf.chat.newMessages') setTimeout $.proxy(() -> document.title = @title - , this), 3000 - , this), 1000 + , @), 3000 + , @), 1000 @handleMessages(data.messages) @handleUsers(data.users) - , this) + , @) ### # Inserts the new messages. # @@ -207,7 +208,7 @@ TimWolla.WCF ?= {} a.click $.proxy (event) -> event.preventDefault() @toggleUserMenu $ event.target - , this + , @ li.append a menu = $ '