BuildFeed/BuildFeed/res/ts/christmas.js

3 lines
1.3 KiB
JavaScript

"use strict";var BuildFeed;!function(t){!function(t){const e=5;let n,i=[],o=0;class s{getElement(){return this.element}bumpElement(t){let n=Math.round((Math.random()/2+.5)*e);return this.top=this.top+n,this.top<-10||this.top>window.innerHeight+10?(this.element.remove(),!0):t&&(n=Math.round((Math.random()/2+.5)*e),this.left=Math.random()>.5?this.left+n:this.left-n,this.left<-10||this.left>window.innerWidth+10)?(this.element.remove(),!0):(this.element.style.transform=`translate(${this.left}px, ${this.top}px)`,!1)}constructor(){this.element=document.createElement("div"),this.top=0,this.left=Math.round(Math.random()*window.innerWidth)}}function r(){window.requestAnimationFrame(a)}function a(){if(o%5==0)for(let t=0;t<2;t++){const t=new s;i.push(t),n.appendChild(t.getElement())}for(const t of i){t.bumpElement(!0)&&i.splice(i.indexOf(t),1)}o++}t.Setup=function(){(n=document.createElement("div")).className="snow-container";const t=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./);(t?parseInt(t[1]):0)>=57&&(n.className+=" quantum-snow-container"),document.body.appendChild(n),window.requestAnimationFrame(a),setInterval(r,125)}}(t.Christmas||(t.Christmas={}))}(BuildFeed||(BuildFeed={})),window.addEventListener("load",BuildFeed.Christmas.Setup);
//# sourceMappingURL=christmas.js.map