1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Formatting of CoffeeScript

This commit is contained in:
Tim Düsterhus 2012-03-07 23:04:19 +01:00
parent ab1618f9c5
commit dfeef5e2d6

View File

@ -63,7 +63,7 @@ consoleMock ?=
# Search all matching users # Search all matching users
for user in $ '.timsChatUser' for user in $ '.timsChatUser'
username = $(user).data('username'); username = $(user).data 'username'
if username.indexOf(firstChars) is 0 if username.indexOf(firstChars) is 0
users.push username users.push username
@ -198,7 +198,7 @@ consoleMock ?=
$('#timsChatTopic').text data.topic $('#timsChatTopic').text data.topic
$('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden') $('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden')
$('.timsChatMessage').addClass('unloaded', 800); $('.timsChatMessage').addClass 'unloaded', 800
@handleMessages data.messages @handleMessages data.messages
document.title = @titleTemplate.fetch data document.title = @titleTemplate.fetch data
, @) , @)
@ -243,7 +243,7 @@ consoleMock ?=
top: '+=' + top top: '+=' + top
left: '+=' + left left: '+=' + left
, 1e3 , 1e3
, 1.5e3); , 1.5e3)
### ###
# Loads new messages. # Loads new messages.
### ###
@ -273,7 +273,7 @@ consoleMock ?=
# Disable scrolling automagically when user manually scrolled # Disable scrolling automagically when user manually scrolled
unless @oldScrollTop is null unless @oldScrollTop is null
if $('.timsChatMessageContainer').scrollTop() < @oldScrollTop if $('.timsChatMessageContainer').scrollTop() < @oldScrollTop
if $('#timsChatAutoscroll').data('status') is 1 if $('#timsChatAutoscroll').data 'status' is 1
$('#timsChatAutoscroll').click() $('#timsChatAutoscroll').click()
$('#timsChatAutoscroll').parent().addClass('default').fadeOut('slow').fadeIn('slow') $('#timsChatAutoscroll').parent().addClass('default').fadeOut('slow').fadeIn('slow')
@ -304,7 +304,7 @@ consoleMock ?=
foundUsers = { } foundUsers = { }
for user in users for user in users
id = 'timsChatUser-'+user.userID id = 'timsChatUser-'+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]
@ -370,7 +370,7 @@ consoleMock ?=
# @param object message # @param object message
### ###
notify: (message) -> notify: (message) ->
return if @isActive or $('#timsChatNotify').data('status') is 0 return if @isActive or $('#timsChatNotify').data 'status' is 0
@newMessageCount++ @newMessageCount++
document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch
@ -379,8 +379,8 @@ consoleMock ?=
# Desktop Notifications # Desktop Notifications
if typeof window.webkitNotifications isnt 'undefined' if typeof window.webkitNotifications isnt 'undefined'
if window.webkitNotifications.checkPermission() is 0 if window.webkitNotifications.checkPermission() is 0
title = WCF.Language.get('wcf.chat.newMessages') title = WCF.Language.get 'wcf.chat.newMessages'
icon = WCF.Icon.get('timwolla.wcf.chat.chat') icon = WCF.Icon.get 'timwolla.wcf.chat.chat'
content = message.username + message.separator + ' ' + message.message content = message.username + message.separator + ' ' + message.message
notification = window.webkitNotifications.createNotification icon, title, content notification = window.webkitNotifications.createNotification icon, title, content
notification.show() notification.show()
@ -400,7 +400,7 @@ consoleMock ?=
success: $.proxy((data, textStatus, jqXHR) -> success: $.proxy((data, textStatus, jqXHR) ->
$('#timsChatRoomList li').remove() $('#timsChatRoomList li').remove()
$('#toggleRooms a').removeClass 'ajaxLoad' $('#toggleRooms a').removeClass 'ajaxLoad'
$('#toggleRooms .wcf-badge').text(data.length); $('#toggleRooms .wcf-badge').text data.length
for room in data for room in data
li = $ '<li></li>' li = $ '<li></li>'
@ -433,7 +433,7 @@ consoleMock ?=
$.ajax $('#timsChatForm').attr('action'), $.ajax $('#timsChatForm').attr('action'),
data: data:
text: text text: text
smilies: $('#timsChatSmilies').data('status') smilies: $('#timsChatSmilies').data 'status'
type: 'POST', type: 'POST',
beforeSend: (jqXHR) -> beforeSend: (jqXHR) ->
$('#timsChatInput').addClass 'ajaxLoad' $('#timsChatInput').addClass 'ajaxLoad'
@ -450,13 +450,13 @@ consoleMock ?=
toggleSidebarContents: (target) -> toggleSidebarContents: (target) ->
return if target.parents('li').hasClass 'active' return if target.parents('li').hasClass 'active'
if target.parents('li').attr('id') is 'toggleUsers' if target.parents('li').attr 'id' is 'toggleUsers'
$('#toggleUsers').addClass 'active' $('#toggleUsers').addClass 'active'
$('#toggleRooms').removeClass 'active' $('#toggleRooms').removeClass 'active'
$('#timsChatRoomList').hide() $('#timsChatRoomList').hide()
$('#timsChatUserList').show() $('#timsChatUserList').show()
else if target.parents('li').attr('id') is 'toggleRooms' else if target.parents('li').attr 'id' is 'toggleRooms'
$('#toggleRooms').addClass 'active' $('#toggleRooms').addClass 'active'
$('#toggleUsers').removeClass 'active' $('#toggleUsers').removeClass 'active'