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

Make only one Message-loading attempt at a time.

This commit is contained in:
Tim Düsterhus 2012-04-19 15:01:38 +02:00
parent 3eaf35c9c1
commit 0b1ad7a02a

View File

@ -23,6 +23,9 @@ consoleMock ?=
# TODO: We need an explosion animation
shields: 3
# Are we currently loading messages?
loading: false
# Templates
titleTemplate: null
messageTemplate: null
@ -209,7 +212,7 @@ consoleMock ?=
# inclusive the error-message :)
window.location.reload true
beforeSend: $.proxy(() ->
return false if @loading or target.parent().hasClass 'activeMenuItem'
return false if target.parent().hasClass('ajaxLoad') or target.parent().hasClass 'activeMenuItem'
@loading = true
target.parent().addClass 'ajaxLoad'
@ -254,6 +257,7 @@ consoleMock ?=
dataType: 'json'
type: 'POST'
success: $.proxy((data, textStatus, jqXHR) ->
@loading = false
@handleMessages(data.messages)
@handleUsers(data.users)
, @)
@ -266,6 +270,11 @@ consoleMock ?=
console.error '[be.bastelstu.WCF.Chat] We got destroyed, but could free our friend the fish before he was killed as well. Have a nice life in freedom!'
alert 'herp i cannot load messages'
, @)
beforeSend: $.proxy(() ->
return false if @loading
@loading = true
, @)
###
# Inserts the new messages.
#