summaryrefslogtreecommitdiff
path: root/frontend/static/js/glitter.js
diff options
context:
space:
mode:
authorroot <root@lalalizard.com>2012-11-26 12:05:40 -0500
committerroot <root@lalalizard.com>2012-11-26 12:05:40 -0500
commitef51b60c6481254d88c5fc3c34f4127b7f881a58 (patch)
tree42a9596a7d53951d2a10f60fea4c2854fc9348af /frontend/static/js/glitter.js
parentddc5b25b4a47ef8175aced9c06fc1767d004e826 (diff)
Frontend static/ folder
Diffstat (limited to 'frontend/static/js/glitter.js')
-rw-r--r--frontend/static/js/glitter.js108
1 files changed, 108 insertions, 0 deletions
diff --git a/frontend/static/js/glitter.js b/frontend/static/js/glitter.js
new file mode 100644
index 0000000..9aed159
--- /dev/null
+++ b/frontend/static/js/glitter.js
@@ -0,0 +1,108 @@
+var Glitter =
+ {
+ path: "/img/glitter/",
+ delay: 50,
+ count: 0,
+ radius: $(window).height() / 3,
+ direction: false,
+ centerX: $(window).width() * 2 / 7,
+ centerY: $(window).height() / 3,
+ loopTimer: false,
+ loopers: [],
+ rotate: function (id, angle, radius, direction, opacity)
+ {
+ if (direction)
+ angle += 2
+ else
+ angle -= 2
+ radians = angle * Math.PI / 180
+ newX = Math.sin(radians) * radius + Glitter.centerX
+ newY = Math.cos(radians) * radius + Glitter.centerY
+ $(id).css({ "left": newX, "top": newY, "opacity": opacity/100 })
+ opacity -= 1
+ if (opacity === 0)
+ {
+ $(id).remove()
+ return false
+ }
+ return [id, angle, radius, direction, opacity]
+ },
+ loop: function ()
+ {
+ var newLoopers = []
+ for (i in Glitter.loopers)
+ {
+ var l = Glitter.loopers[i]
+ var r = Glitter.rotate(l[0], l[1], l[2], l[3], l[4])
+ if (r)
+ newLoopers.push(r)
+ }
+ Glitter.loopers = newLoopers
+ Glitter.loopTimer = setTimeout(Glitter.loop, Glitter.delay)
+ },
+ go: function ()
+ {
+ Glitter.count += 1
+ // if (Glitter.count % 20 === 0)
+ // Glitter.direction = ! Glitter.direction
+ var index = Math.floor( Math.random() * GLITTER_DATA.length )
+ var radius = Glitter.radius + Math.floor( Math.random() * 100 )
+ var angle = Math.floor( Math.random() * 360 )
+ var opacity = 100
+ var newsrc = GLITTER_DATA[index]
+ var newid = "glitter_" + Glitter.count
+ var newdiv = "<div id='"+newid+"' class='glitter'><img src='"+Glitter.path+newsrc+"'/></div>"
+ // console.log(newdiv)
+ $("body").append(newdiv)
+ Glitter.loopers.push(["#"+newid, angle, radius, Glitter.direction, opacity])
+ if (! Glitter.loopTimer)
+ Glitter.loop()
+ },
+ generate: function (count)
+ {
+ if (count > 1)
+ count = 1
+ for (var i = 0; i < count; i++)
+ setTimeout(Glitter.go, 50)
+ },
+ oldTextareaMap: Keyboard.textareaMap,
+ oldStandardMap: Keyboard.standardMap,
+ oldFullscreenMap: Keyboard.fullscreenMap,
+ fullscreenMap: function (event)
+ {
+ Chat.callback(1)
+ return Glitter.oldFullscreenMap(event)
+ },
+ standardMap: function (event)
+ {
+ Chat.callback(1)
+ return Glitter.oldStandardMap(event)
+ },
+ textareaMap: function (event)
+ {
+ Chat.callback(1)
+ return Glitter.oldTextareaMap(event)
+ },
+ init: function ()
+ {
+ $("#glitter-go").bind("click", Glitter.go)
+ $("#flower img").attr("src", "/img/glitter_flower.gif")
+ Chat.callback = Glitter.generate
+ Like.likeVideoDelay = 10000
+ var newtitle = "<img src='/img/glitter_scannerjammer.gif' />"
+ setTimeout('$("#heading").html("'+newtitle+'")', 6000)
+ $("#topic").css({position:"fixed", top: 40, left: 750})
+ Room.loadCallback = function ()
+ {
+ setTimeout(Viewport.fullscreenOn, 500)
+ setTimeout('$("#logobg").css({width: "100%"})', 1000)
+ Keyboard.textareaMap = Glitter.textareaMap
+ Keyboard.standardMap = Glitter.standardMap
+ Keyboard.fullscreenMap = Glitter.fullscreenMap
+ Keyboard.focusTextarea()
+ }
+ },
+ }
+Glitter.init()
+
+