1(function (window, document, undefined) { 2 var hearts = []; 3 window.requestAnimationFrame = (function () { 4 return window.requestAnimationFrame || 5 window.webkitRequestAnimationFrame || 6 window.mozRequestAnimationFrame || 7 window.oRequestAnimationFrame || 8 window.msRequestAnimationFrame || 9 function (callback) { 10 setTimeout(callback, 1000 / 60); 11 } 12 })(); 13 init(); 14 15 function init() { 16 css( 17 ".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: absolute;}.heart:after{top: -5px;}.heart:before{left: -5px;}" 18 ); 19 attachEvent(); 20 gameloop(); 21 } 22 23 function gameloop() { 24 for (var i = 0; i < hearts.length; i++) { 25 if (hearts[i].alpha <= 0) { 26 document.body.removeChild(hearts[i].el); 27 hearts.splice(i, 1); 28 continue; 29 } 30 hearts[i].y--; 31 hearts[i].scale += 0.004; 32 hearts[i].alpha -= 0.013; 33 hearts[i].el.style.cssText = "left:" + hearts[i].x + "px;top:" + hearts[i].y + "px;opacity:" + hearts[i] 34 .alpha + ";transform:scale(" + hearts[i].scale + "," + hearts[i].scale + 35 ") rotate(45deg);background:" + hearts[i].color; 36 } 37 requestAnimationFrame(gameloop); 38 } 39 40 function attachEvent() { 41 var old = typeof window.onclick === "function" && window.onclick; 42 window.onclick = function (event) { 43 old && old(); 44 createHeart(event); 45 } 46 } 47 48 function createHeart(event) { 49 var d = document.createElement("div"); 50 d.className = "heart"; 51 hearts.push({ 52 el: d, 53 x: event.clientX - 5, 54 y: event.clientY - 5, 55 scale: 1, 56 alpha: 1, 57 color: randomColor() 58 }); 59 document.body.appendChild(d); 60 } 61 62 function css(css) { 63 var style = document.createElement("style"); 64 style.type = "text/css"; 65 try { 66 style.appendChild(document.createTextNode(css)); 67 } catch (ex) { 68 style.styleSheet.cssText = css; 69 } 70 document.getElementsByTagName('head')[0].appendChild(style); 71 } 72 73 function randomColor() { 74 return "rgb(" + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + "," + (~~(Math.random() * 255)) + 75 ")"; 76 } 77})(window, document); 78
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.