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

== -> is != -> isnt

This commit is contained in:
Tim Düsterhus 2011-12-24 17:48:08 +01:00
parent bbc8efa5ee
commit 3a32aa1b8c

View File

@ -51,7 +51,7 @@ TimWolla.WCF ?= {}
$('.chatToggle').click (event) -> $('.chatToggle').click (event) ->
element = $ this element = $ this
icon = element.find 'img' icon = element.find 'img'
if element.data('status') == 1 if element.data('status') is 1
element.data 'status', 0 element.data 'status', 0
icon.attr 'src', icon.attr('src').replace /enabled(\d?).([a-z]{3})$/, 'disabled$1.$2' icon.attr 'src', icon.attr('src').replace /enabled(\d?).([a-z]{3})$/, 'disabled$1.$2'
element.attr 'title', element.data 'enableMessage' element.attr 'title', element.data 'enableMessage'
@ -81,14 +81,14 @@ TimWolla.WCF ?= {}
target.parent().addClass 'activeMenuItem' target.parent().addClass 'activeMenuItem'
# set new topic # set new topic
if data.topic == '' if data.topic is ''
return if $('#topic').text().trim() == '' return if $('#topic').text().trim() is ''
$('#topic').wcfBlindOut 'vertical', () -> $('#topic').wcfBlindOut 'vertical', () ->
$(this).text '' $(this).text ''
else else
$('#topic').text data.topic $('#topic').text data.topic
$('#topic').wcfBlindIn() if $('#topic').text().trim() != '' $('#topic').wcfBlindIn() if $('#topic').text().trim() isnt ''
$('title').text @titleTemplate.fetch(data) $('title').text @titleTemplate.fetch(data)
, this) , this)
@ -142,7 +142,7 @@ TimWolla.WCF ?= {}
output = @messageTemplate.fetch message output = @messageTemplate.fetch message
li = $ '<li></li>' li = $ '<li></li>'
li.addClass 'chatMessage chatMessage'+message.type li.addClass 'chatMessage chatMessage'+message.type
li.addClass 'ownMessage' if message.sender == WCF.User.userID li.addClass 'ownMessage' if message.sender is WCF.User.userID
li.append output li.append output
li.appendTo $ '.chatMessageContainer ul' li.appendTo $ '.chatMessageContainer ul'
@ -188,7 +188,7 @@ TimWolla.WCF ?= {}
$('<a href="' + room.link + '">' + room.title + '</a>').addClass('chatRoom').appendTo li $('<a href="' + room.link + '">' + room.title + '</a>').addClass('chatRoom').appendTo li
$('#chatRoomList ul').append li $('#chatRoomList ul').append li
$('.chatRoom').click $.proxy (event) -> $('.chatRoom').click $.proxy (event) ->
return if typeof window.history.replaceState == 'undefined' return if typeof window.history.replaceState is 'undefined'
event.preventDefault() event.preventDefault()
@changeRoom $ event.target @changeRoom $ event.target
, this , this
@ -200,9 +200,9 @@ TimWolla.WCF ?= {}
### ###
submit: (target) -> submit: (target) ->
# break if input contains only whitespace # break if input contains only whitespace
return false if $('#chatInput').val().trim().length == 0 return false if $('#chatInput').val().trim().length is 0
@freeTheFish() if $('#chatInput').val().trim() == '/free the fish' @freeTheFish() if $('#chatInput').val().trim() is '/free the fish'
$.ajax $('#chatForm').attr('action'), $.ajax $('#chatForm').attr('action'),
data: data:
@ -226,13 +226,13 @@ TimWolla.WCF ?= {}
toggleSidebarContents: (target) -> toggleSidebarContents: (target) ->
return if target.parent().hasClass 'active' return if target.parent().hasClass 'active'
if target.parent().attr('id') == 'toggleUsers' if target.parent().attr('id') is 'toggleUsers'
$('#toggleUsers').addClass 'active' $('#toggleUsers').addClass 'active'
$('#toggleRooms').removeClass 'active' $('#toggleRooms').removeClass 'active'
$('#chatRoomList').hide() $('#chatRoomList').hide()
$('#chatUserList').show() $('#chatUserList').show()
else if target.parent().attr('id') == 'toggleRooms' else if target.parent().attr('id') is 'toggleRooms'
$('#toggleRooms').addClass 'active' $('#toggleRooms').addClass 'active'
$('#toggleUsers').removeClass 'active' $('#toggleUsers').removeClass 'active'