mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
this. -> @
This commit is contained in:
parent
8fbc956111
commit
bbc8efa5ee
@ -15,9 +15,9 @@ TimWolla.WCF ?= {}
|
|||||||
titleTemplate: null
|
titleTemplate: null
|
||||||
messageTemplate: null
|
messageTemplate: null
|
||||||
init: (roomID, messageID) ->
|
init: (roomID, messageID) ->
|
||||||
this.bindEvents()
|
@bindEvents()
|
||||||
this.refreshRoomList()
|
@refreshRoomList()
|
||||||
new WCF.PeriodicalExecuter $.proxy(this.refreshRoomList, this), 10e3
|
new WCF.PeriodicalExecuter $.proxy(@refreshRoomList, this), 10e3
|
||||||
|
|
||||||
$('#chatInput').focus()
|
$('#chatInput').focus()
|
||||||
###
|
###
|
||||||
@ -25,22 +25,22 @@ TimWolla.WCF ?= {}
|
|||||||
###
|
###
|
||||||
bindEvents: () ->
|
bindEvents: () ->
|
||||||
$('.smiley').click $.proxy (event) ->
|
$('.smiley').click $.proxy (event) ->
|
||||||
this.insertText ' ' + $(event.target).attr('alt') + ' '
|
@insertText ' ' + $(event.target).attr('alt') + ' '
|
||||||
, this
|
, this
|
||||||
|
|
||||||
$('.chatSidebarTabs li').click $.proxy (event) ->
|
$('.chatSidebarTabs li').click $.proxy (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.toggleSidebarContents $ event.target
|
@toggleSidebarContents $ event.target
|
||||||
, this
|
, this
|
||||||
|
|
||||||
$('.chatUser .chatUserLink').click $.proxy (event) ->
|
$('.chatUser .chatUserLink').click $.proxy (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.toggleUserMenu $ event.target
|
@toggleUserMenu $ event.target
|
||||||
, this
|
, this
|
||||||
|
|
||||||
$('#chatForm').submit $.proxy (event) ->
|
$('#chatForm').submit $.proxy (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.submit $ event.target
|
@submit $ event.target
|
||||||
, this
|
, this
|
||||||
|
|
||||||
$('#chatClear').click (event) ->
|
$('#chatClear').click (event) ->
|
||||||
@ -73,7 +73,7 @@ TimWolla.WCF ?= {}
|
|||||||
ajax: 1
|
ajax: 1
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
success: $.proxy((data, textStatus, jqXHR) ->
|
success: $.proxy((data, textStatus, jqXHR) ->
|
||||||
this.loading = false
|
@loading = false
|
||||||
target.parent().removeClass 'ajaxLoad'
|
target.parent().removeClass 'ajaxLoad'
|
||||||
|
|
||||||
# mark as active
|
# mark as active
|
||||||
@ -90,16 +90,16 @@ TimWolla.WCF ?= {}
|
|||||||
$('#topic').text data.topic
|
$('#topic').text data.topic
|
||||||
$('#topic').wcfBlindIn() if $('#topic').text().trim() != ''
|
$('#topic').wcfBlindIn() if $('#topic').text().trim() != ''
|
||||||
|
|
||||||
$('title').text this.titleTemplate.fetch(data)
|
$('title').text @titleTemplate.fetch(data)
|
||||||
, this)
|
, this)
|
||||||
error: () ->
|
error: () ->
|
||||||
# reload page to change the room the old fashion-way
|
# reload page to change the room the old fashion-way
|
||||||
# inclusive the error-message :)
|
# inclusive the error-message :)
|
||||||
window.location.reload true
|
window.location.reload true
|
||||||
beforeSend: $.proxy(() ->
|
beforeSend: $.proxy(() ->
|
||||||
return false if this.loading or target.parent().hasClass 'activeMenuItem'
|
return false if @loading or target.parent().hasClass 'activeMenuItem'
|
||||||
|
|
||||||
this.loading = true
|
@loading = true
|
||||||
target.parent().addClass 'ajaxLoad'
|
target.parent().addClass 'ajaxLoad'
|
||||||
, this)
|
, this)
|
||||||
###
|
###
|
||||||
@ -139,7 +139,7 @@ TimWolla.WCF ?= {}
|
|||||||
###
|
###
|
||||||
handleMessages: (messages) ->
|
handleMessages: (messages) ->
|
||||||
for message in messages
|
for message in messages
|
||||||
output = this.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 == WCF.User.userID
|
||||||
@ -190,7 +190,7 @@ TimWolla.WCF ?= {}
|
|||||||
$('.chatRoom').click $.proxy (event) ->
|
$('.chatRoom').click $.proxy (event) ->
|
||||||
return if typeof window.history.replaceState == 'undefined'
|
return if typeof window.history.replaceState == 'undefined'
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.changeRoom $ event.target
|
@changeRoom $ event.target
|
||||||
, this
|
, this
|
||||||
, this)
|
, this)
|
||||||
###
|
###
|
||||||
@ -202,7 +202,7 @@ TimWolla.WCF ?= {}
|
|||||||
# 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 == 0
|
||||||
|
|
||||||
this.freeTheFish() if $('#chatInput').val().trim() == '/free the fish'
|
@freeTheFish() if $('#chatInput').val().trim() == '/free the fish'
|
||||||
|
|
||||||
$.ajax $('#chatForm').attr('action'),
|
$.ajax $('#chatForm').attr('action'),
|
||||||
data:
|
data:
|
||||||
@ -212,7 +212,7 @@ TimWolla.WCF ?= {}
|
|||||||
beforeSend: (jqXHR) ->
|
beforeSend: (jqXHR) ->
|
||||||
$('#chatInput').addClass 'ajaxLoad'
|
$('#chatInput').addClass 'ajaxLoad'
|
||||||
success: $.proxy((data, textStatus, jqXHR) ->
|
success: $.proxy((data, textStatus, jqXHR) ->
|
||||||
this.getMessages()
|
@getMessages()
|
||||||
$('#chatInput').val('').focus()
|
$('#chatInput').val('').focus()
|
||||||
$('#chatInput').keyup()
|
$('#chatInput').keyup()
|
||||||
, this)
|
, this)
|
||||||
|
Loading…
Reference in New Issue
Block a user