From b8642eabeece6c6102137e42ae1871600855f711 Mon Sep 17 00:00:00 2001 From: Jason DeCamp Date: Wed, 19 Dec 2018 23:29:56 -0500 Subject: [PATCH 1/2] Fix snowStorm.autoStart functionality the order that the startup sequence currently uses does not allow the existing configuration steps to override the default value before it is executed, this patch should fix it. --- snowstorm.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/snowstorm.js b/snowstorm.js index d73aebe..3008d93 100755 --- a/snowstorm.js +++ b/snowstorm.js @@ -650,7 +650,7 @@ var snowStorm = (function(window, document) { } function doStart() { - if (!storm.excludeMobile || !isMobile) { + if (storm.autoStart && (!storm.excludeMobile || !isMobile)) { doDelayedStart(); } // event cleanup @@ -658,9 +658,7 @@ var snowStorm = (function(window, document) { } // hooks for starting the snow - if (storm.autoStart) { - storm.events.add(window, 'load', doStart, false); - } + storm.events.add(window, 'load', doStart, false); return this; From 6f20245260f4cfdc4e3d448e6a8134e4856796fc Mon Sep 17 00:00:00 2001 From: Jason DeCamp Date: Wed, 19 Dec 2018 23:33:56 -0500 Subject: [PATCH 2/2] fix autoStart functionality --- snowstorm-min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snowstorm-min.js b/snowstorm-min.js index 1559e4e..80227ea 100644 --- a/snowstorm-min.js +++ b/snowstorm-min.js @@ -8,7 +8,7 @@ Code provided under the BSD License http://schillmania.com/projects/snowstorm/license.txt */ -var snowStorm=function(g,f){function k(a,d){isNaN(d)&&(d=0);return Math.random()*a+d}function x(){g.setTimeout(function(){a.start(!0)},20);a.events.remove(m?f:g,"mousemove",x)}function y(){(!a.excludeMobile||!D)&&x();a.events.remove(g,"load",y)}this.excludeMobile=this.autoStart=!0;this.flakesMax=128;this.flakesMaxActive=64;this.animationInterval=33;this.useGPU=!0;this.className=null;this.excludeMobile=!0;this.flakeBottom=null;this.followMouse=!0;this.snowColor="#fff";this.snowCharacter="•";this.snowStick= +var snowStorm=function(g,f){function k(a,d){isNaN(d)&&(d=0);return Math.random()*a+d}function x(){g.setTimeout(function(){a.start(!0)},20);a.events.remove(m?f:g,"mousemove",x)}function y(){a.autoStart&&(!a.excludeMobile||!D)&&x();a.events.remove(g,"load",y)}this.excludeMobile=this.autoStart=!0;this.flakesMax=128;this.flakesMaxActive=64;this.animationInterval=33;this.useGPU=!0;this.className=null;this.excludeMobile=!0;this.flakeBottom=null;this.followMouse=!0;this.snowColor="#fff";this.snowCharacter="•";this.snowStick= !0;this.targetElement=null;this.useMeltEffect=!0;this.usePixelPosition=this.usePositionFixed=this.useTwinkleEffect=!1;this.freezeOnBlur=!0;this.flakeRightOffset=this.flakeLeftOffset=0;this.flakeHeight=this.flakeWidth=8;this.vMaxX=5;this.vMaxY=4;this.zIndex=0;var a=this,q,m=navigator.userAgent.match(/msie/i),E=navigator.userAgent.match(/msie 6/i),D=navigator.userAgent.match(/mobile|opera m(ob|in)/i),r=m&&"BackCompat"===f.compatMode||E,h=null,n=null,l=null,p=null,s=null,z=null,A=null,v=1,t=!1,w=!1, u;a:{try{f.createElement("div").style.opacity="0.5"}catch(F){u=!1;break a}u=!0}var B=!1,C=f.createDocumentFragment();q=function(){function c(b){g.setTimeout(b,1E3/(a.animationInterval||20))}function d(a){return void 0!==h.style[a]?a:null}var e,b=g.requestAnimationFrame||g.webkitRequestAnimationFrame||g.mozRequestAnimationFrame||g.oRequestAnimationFrame||g.msRequestAnimationFrame||c;e=b?function(){return b.apply(g,arguments)}:null;var h;h=f.createElement("div");e={transform:{ie:d("-ms-transform"), moz:d("MozTransform"),opera:d("OTransform"),webkit:d("webkitTransform"),w3:d("transform"),prop:null},getAnimationFrame:e};e.transform.prop=e.transform.w3||e.transform.moz||e.transform.webkit||e.transform.ie||e.transform.opera;h=null;return e}();this.timer=null;this.flakes=[];this.active=this.disabled=!1;this.meltFrameCount=20;this.meltFrames=[];this.setXY=function(c,d,e){if(!c)return!1;a.usePixelPosition||w?(c.style.left=d-a.flakeWidth+"px",c.style.top=e-a.flakeHeight+"px"):r?(c.style.right=100-100* @@ -26,4 +26,4 @@ a.style.opacity=b};this.melt=function(){!a.useMeltEffect||!b.melting?b.recycle() a.flakes[d].melting&&a.flakes[d].melt();ca.flakesMaxActive)a.flakes[a.flakes.length-1].active=-1;a.targetElement.appendChild(C)};this.timerInit= function(){a.timer=!0;a.snow()};this.init=function(){var c;for(c=0;c