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 = "
" // 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 = "" 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()