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

Someone freed the fish, oh a noez

This commit is contained in:
Tim Düsterhus 2011-12-24 17:28:36 +01:00
parent 90f1213ef7
commit 8fbc956111

View File

@ -103,6 +103,32 @@ TimWolla.WCF ?= {}
target.parent().addClass 'ajaxLoad' target.parent().addClass 'ajaxLoad'
, this) , this)
### ###
# Frees the fish
###
freeTheFish: () ->
return if $.wcfIsset('fish')
fish = $ '<div id="fish">' + WCF.String.escapeHTML('><((((°>') + '</div>'
fish.css
position: 'absolute'
top: '150px'
left: '400px'
color: 'black'
textShadow: '1px 1px white'
zIndex: 9999
fish.appendTo $ 'body'
new WCF.PeriodicalExecuter(() ->
left = (Math.random() * 100 - 50)
$('#fish').text('><((((°>') if (left > 0)
$('#fish').text('<°))))><') if (left < 0)
$('#fish').animate
top: '+=' + (Math.random() * 100 - 50)
left: '+=' + left
, 1000
, 3e3);
###
# Loads new messages. # Loads new messages.
### ###
getMessages: () -> getMessages: () ->
@ -176,6 +202,8 @@ 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'
$.ajax $('#chatForm').attr('action'), $.ajax $('#chatForm').attr('action'),
data: data:
text: $('#chatInput').val(), text: $('#chatInput').val(),