mirror of
https://github.com/ConjureETS/Site.git
synced 2026-03-24 09:40:57 +00:00
1 line
974 B
JavaScript
1 line
974 B
JavaScript
function addCopyrightCurrentDate(){document.querySelector("footer").querySelector("p").innerHTML+=" "+(new Date).getFullYear()}function showActivityContent(e){e.target.parentElement.parentElement.querySelector(".headline").classList.toggle("toggle-visibility"),e.target.parentElement.parentElement.classList.toggle("slide")}function pad(e,t,n){return n=n||"0",(e+="").length>=t?e:new Array(t-e.length+1).join(n)+e}function animateNumbers(e){setTimeout(function(){let t=1*(null===e.getAttribute("data-endvalue")?(new Date).getFullYear():e.getAttribute("data-endvalue")),n=setInterval(function(){t-=1,e.innerHTML=pad(parseInt(e.innerHTML)+1,4),t<=0&&clearInterval(n)},1)},null===e.getAttribute("data-delay")?250:e.getAttribute("data-delay"))}addCopyrightCurrentDate(),document.querySelectorAll("section#activites button").forEach(function(e){e.addEventListener("click",showActivityContent)}),document.querySelectorAll(".year-animated").forEach(function(e){animateNumbers(e)}); |