1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-10 00:30:09 +00:00

Removing some inconsistencies

This commit is contained in:
Tim Düsterhus 2012-01-22 14:48:11 +01:00
parent 94a48df147
commit 06c77bafde

View File

@ -19,7 +19,7 @@ TimWolla.WCF ?= {}
newMessage: $.Callbacks() newMessage: $.Callbacks()
userMenu: $.Callbacks() userMenu: $.Callbacks()
init: () -> init: () ->
console.log('[TimWolla.WCF.Chat] Initializing'); console.log '[TimWolla.WCF.Chat] Initializing'
@bindEvents() @bindEvents()
@events.newMessage.add $.proxy @notify, @ @events.newMessage.add $.proxy @notify, @
@ -35,7 +35,8 @@ TimWolla.WCF ?= {}
bindEvents: () -> bindEvents: () ->
@isActive = true @isActive = true
$(window).focus $.proxy () -> $(window).focus $.proxy () ->
document.title = @titleTemplate.fetch({ title: $('#chatRoomList .activeMenuItem a').text() }) document.title = @titleTemplate.fetch
title: $('#chatRoomList .activeMenuItem a').text()
@newMessageCount = 0 @newMessageCount = 0
@isActive = true @isActive = true
, @ , @
@ -109,7 +110,7 @@ TimWolla.WCF ?= {}
$('#topic').text data.topic $('#topic').text data.topic
$('#topic').wcfBlindIn() if $('#topic').text().trim() isnt '' and $('#topic').is(':hidden') $('#topic').wcfBlindIn() if $('#topic').text().trim() isnt '' and $('#topic').is(':hidden')
$('title').text @titleTemplate.fetch(data) $('title').text @titleTemplate.fetch data
@getMessages() @getMessages()
, @) , @)
error: () -> error: () ->
@ -250,11 +251,15 @@ TimWolla.WCF ?= {}
return if (@isActive or $('#chatNotify').data('status') is 0) return if (@isActive or $('#chatNotify').data('status') is 0)
@newMessageCount++ @newMessageCount++
document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch({ title: $('#chatRoomList .activeMenuItem a').text() }) document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch
title: $('#chatRoomList .activeMenuItem a').text()
if typeof window.webkitNotifications isnt 'undefined' if typeof window.webkitNotifications isnt 'undefined'
if window.webkitNotifications.checkPermission() is 0 if window.webkitNotifications.checkPermission() is 0
notification = window.webkitNotifications.createNotification WCF.Icon.get('timwolla.wcf.chat.chat'), WCF.Language.get('wcf.chat.newMessages'), message.username + ' ' + message.message title = WCF.Language.get('wcf.chat.newMessages')
icon = WCF.Icon.get('timwolla.wcf.chat.chat')
content = message.username + message.separator + ' ' + message.message
notification = window.webkitNotifications.createNotification icon, title, content
notification.show() notification.show()
setTimeout(() -> setTimeout(() ->
notification.cancel() notification.cancel()