mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Clean up CoffeeScript a bit
This commit is contained in:
parent
cd926813bc
commit
14b453495c
@ -93,8 +93,7 @@ When **Tims Chat** becomes focused mark the chat as active and remove the number
|
|||||||
|
|
||||||
When **Tims Chat** loses the focus mark the chat as inactive.
|
When **Tims Chat** loses the focus mark the chat as inactive.
|
||||||
|
|
||||||
$(window).blur ->
|
$(window).blur -> isActive = false
|
||||||
isActive = false
|
|
||||||
|
|
||||||
Make the user leave the chat when **Tims Chat** is about to be unloaded.
|
Make the user leave the chat when **Tims Chat** is about to be unloaded.
|
||||||
|
|
||||||
@ -113,13 +112,11 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded.
|
|||||||
|
|
||||||
Insert the appropriate smiley code into the input when a smiley is clicked.
|
Insert the appropriate smiley code into the input when a smiley is clicked.
|
||||||
|
|
||||||
$('#smilies').on 'click', 'img', ->
|
$('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} "
|
||||||
insertText " #{$(@).attr('alt')} "
|
|
||||||
|
|
||||||
Handle private channel menu
|
Handle private channel menu
|
||||||
|
|
||||||
$('#privateChannelsMenu').on 'click', '.privateChannel', ->
|
$('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID'
|
||||||
openPrivateChannel $(@).data 'privateChannelID'
|
|
||||||
|
|
||||||
Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners
|
Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners
|
||||||
and afterwards sent to the server by an AJAX request.
|
and afterwards sent to the server by an AJAX request.
|
||||||
@ -132,8 +129,7 @@ and afterwards sent to the server by an AJAX request.
|
|||||||
|
|
||||||
return false if text.length is 0
|
return false if text.length is 0
|
||||||
|
|
||||||
unless openChannel is 0
|
text = "/whisper #{userList.allTime[openChannel].username}, #{text}" unless openChannel is 0
|
||||||
text = "/whisper #{userList.allTime[openChannel].username}, #{text}"
|
|
||||||
|
|
||||||
# Free the fish!
|
# Free the fish!
|
||||||
do freeTheFish if text.toLowerCase() is '/free the fish'
|
do freeTheFish if text.toLowerCase() is '/free the fish'
|
||||||
@ -222,8 +218,7 @@ Reset autocompleter to default status, when the input is `click`ed, as the posit
|
|||||||
|
|
||||||
Refresh the room list when the associated button is `click`ed.
|
Refresh the room list when the associated button is `click`ed.
|
||||||
|
|
||||||
$('#timsChatRoomList button').click ->
|
$('#timsChatRoomList button').click -> do refreshRoomList
|
||||||
do refreshRoomList
|
|
||||||
|
|
||||||
Clear the chat by removing every single message once the clear button is `clicked`.
|
Clear the chat by removing every single message once the clear button is `clicked`.
|
||||||
|
|
||||||
@ -261,7 +256,7 @@ Toggle fullscreen mode.
|
|||||||
# Force dropdowns to reorientate
|
# Force dropdowns to reorientate
|
||||||
$('.dropdownMenu').data 'orientationX', ''
|
$('.dropdownMenu').data 'orientationX', ''
|
||||||
|
|
||||||
if $('#timsChatFullscreen').data 'status'
|
if $(@).data 'status'
|
||||||
$('html').addClass 'fullscreen'
|
$('html').addClass 'fullscreen'
|
||||||
else
|
else
|
||||||
$('html').removeClass 'fullscreen'
|
$('html').removeClass 'fullscreen'
|
||||||
@ -326,7 +321,7 @@ Ask for permissions to use Desktop notifications when notifications are activate
|
|||||||
if window.Notification?
|
if window.Notification?
|
||||||
$('#timsChatNotify').click (event) ->
|
$('#timsChatNotify').click (event) ->
|
||||||
return unless $(@).data 'status'
|
return unless $(@).data 'status'
|
||||||
if window.Notification.permission isnt 'granted'
|
unless window.Notification.permission is 'granted'
|
||||||
window.Notification.requestPermission (permission) ->
|
window.Notification.requestPermission (permission) ->
|
||||||
window.Notification.permission ?= permission
|
window.Notification.permission ?= permission
|
||||||
|
|
||||||
@ -682,9 +677,9 @@ Shows an unrecoverable error with the given text.
|
|||||||
""").appendTo 'body'
|
""").appendTo 'body'
|
||||||
|
|
||||||
formSubmit = $("""<div class="formSubmit"></div>""").appendTo errorDialog
|
formSubmit = $("""<div class="formSubmit"></div>""").appendTo errorDialog
|
||||||
|
|
||||||
reloadButton = $("""<button class="buttonPrimary">#{WCF.Language.get 'chat.error.reload'}</button>""").appendTo formSubmit
|
reloadButton = $("""<button class="buttonPrimary">#{WCF.Language.get 'chat.error.reload'}</button>""").appendTo formSubmit
|
||||||
reloadButton.on 'click', ->
|
reloadButton.on 'click', -> do window.location.reload
|
||||||
do window.location.reload
|
|
||||||
|
|
||||||
$('#timsChatLoadingErrorDialog').wcfDialog
|
$('#timsChatLoadingErrorDialog').wcfDialog
|
||||||
closable: false
|
closable: false
|
||||||
@ -743,6 +738,7 @@ Open private channel
|
|||||||
$('#timsChatMessageContainer0').after div
|
$('#timsChatMessageContainer0').after div
|
||||||
|
|
||||||
$('.privateChannel').removeClass 'active'
|
$('.privateChannel').removeClass 'active'
|
||||||
|
|
||||||
if userID isnt 0
|
if userID isnt 0
|
||||||
$('#timsChatTopic').removeClass 'hidden empty'
|
$('#timsChatTopic').removeClass 'hidden empty'
|
||||||
$('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username}
|
$('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username}
|
||||||
|
Loading…
Reference in New Issue
Block a user