blob: 3aa84101a63cffad6b6a1dabad16e970b104b13c [file] [log] [blame]
(function(){var k=document.querySelector("#burger-menu"),i=[].slice.call(document.querySelectorAll(".nav-link")),d=document.querySelector("body"),f=function(m,l){if(m.className.indexOf(l)===-1){m.className+=" "+l}},h=function(n,m){var l=n.className.replace(" "+m,"");n.className=l},c=function(m,n,l){if(n){f(m,l)}else{h(m,l)}},a=function(l){window.history.pushState(null,l.text,l)};if(!window.location.hostname==="localhost"){var j=window.location.pathname.replace("/","");if(j){window.scrollTo(0,document.querySelector("#"+j).offsetTop)}}[].slice.call(document.querySelectorAll(".ripple-btn")).forEach(function(l){l.addEventListener("mousedown",function(n){var m=this.querySelector(".ripple");f(m,"visible");m.style.transform="translate(-50%, -50%) translate("+n.layerX+"px, "+n.layerY+"px) scale(0.0001, 0.0001)";setTimeout(function(){m.style.transform=m.style.transform.replace(" scale(0.0001, 0.0001)","")},200)},true);l.addEventListener("mouseup",function(){var m=this.querySelector(".ripple");h(m,"visible")},true)});i.forEach(function(l){l.addEventListener("click",function(p){var o=document.querySelector("#"+this.getAttribute("href")),n=o.offsetTop,m=window.scrollY;p.preventDefault();window.removeEventListener("scroll",e);a(this);if(m<=n){g(m,n)}else{b(m,n)}window.addEventListener("scroll",e)},true)});var g=function(m,l){var o=0.1,n=function(){var p=(l-m);o+=1.25;if(p<40){m+=p}else{m+=(1*o)}window.scrollTo(0,m);if(m<l){window.requestAnimationFrame(n)}};window.requestAnimationFrame(n)};var b=function(m,l){var o=0.1,n=function(){var p=(m-l);o+=1.25;if(p<40){m-=p}else{m-=(1*o)}window.scrollTo(0,m);if(m>l){window.requestAnimationFrame(n)}};window.requestAnimationFrame(n)};document.querySelector(".back-to-top").addEventListener("click",function(){window.history.replaceState(null,null,"/");b(window.scrollY,0)},true);k.addEventListener("click",function(){if(d.className.indexOf("active")===-1){f(d,"active")}else{h(d,"active");d.removeEventListener("click",this)}},true);var e=function(){c(document.querySelector("header"),document.body.scrollTop>=100,"active");c(document.querySelector("body"),document.body.scrollTop>=280,"scrolled")};window.addEventListener("scroll",e)}());