diff --git a/public/js/main.min.js b/public/js/main.min.js index 2d41326..d8846db 100644 --- a/public/js/main.min.js +++ b/public/js/main.min.js @@ -1 +1 @@ -function addCopyrightCurrentDate(){document.querySelector("footer").querySelector("p").innerHTML+=" "+(new Date).getFullYear()}function showActivityContent(t){t.target.parentElement.parentElement.querySelector(".headline").classList.toggle("toggle-visibility"),t.target.parentElement.parentElement.classList.toggle("slide")}function pad(t,e,i){return i=i||"0",(t+="").length>=e?t:new Array(e-t.length+1).join(i)+t}function animateNumbers(t){setTimeout(function(){let e=1*(null===t.getAttribute("data-endvalue")?(new Date).getFullYear():t.getAttribute("data-endvalue")),i=setInterval(function(){e-=1,t.innerHTML=pad(parseInt(t.innerHTML)+1,4),e<=0&&clearInterval(i)},1)},null===t.getAttribute("data-delay")?250:t.getAttribute("data-delay"))}addCopyrightCurrentDate(),document.querySelectorAll("section#activites button").forEach(function(t){t.addEventListener("click",showActivityContent)}),document.querySelectorAll(".year-animated").forEach(function(t){animateNumbers(t)}),bulmaCarousel.attach(".slider",{autoplay:!0,pagination:!1,loop:!0,slidesToShow:2,slidesToScroll:2,infinite:!0,icons:{previous:'',next:''}}); \ No newline at end of file +function addCopyrightCurrentDate(){document.querySelector("footer").querySelector("p").innerHTML+=" "+(new Date).getFullYear()}function showActivityContent(t){t.target.parentElement.parentElement.querySelector(".headline").classList.toggle("toggle-visibility"),t.target.parentElement.parentElement.classList.toggle("slide")}function pad(t,e,n){return n=n||"0",(t+="").length>=e?t:new Array(e-t.length+1).join(n)+t}function animateNumbers(t){setTimeout(function(){let e=t.getAttribute("data-endvalue"),n=1*(e=parseInt(null===e?(new Date).getFullYear():e))/7;console.log(n),console.log(void 0===e||0===e?(new Date).getFullYear():e);let i=setInterval(function(){n-=1;let l=parseInt(t.innerHTML);t.innerHTML=pad(l+7>e?l+(e-l):l+7,4),n<=0&&clearInterval(i)},1)},null===t.getAttribute("data-delay")?250:t.getAttribute("data-delay"))}addCopyrightCurrentDate(),document.querySelectorAll("section#activites button").forEach(function(t){t.addEventListener("click",showActivityContent)}),document.querySelectorAll(".year-animated").forEach(function(t){animateNumbers(t)}),bulmaCarousel.attach(".slider",{autoplay:!0,pagination:!1,loop:!0,slidesToShow:2,slidesToScroll:2,infinite:!0,icons:{previous:'',next:''}}); \ No newline at end of file diff --git a/resources/js/app.js b/resources/js/app.js index 852ffa0..748255c 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -40,11 +40,17 @@ function pad(n, width, z) { function animateNumbers(item) { let intervalTime = 1; + let incrementation = 7; setTimeout(function() { - let duration = (item.getAttribute('data-endvalue') === null ? new Date().getFullYear() : item.getAttribute('data-endvalue')) * intervalTime; + let endValue = item.getAttribute('data-endvalue'); + endValue = parseInt(endValue === null ? new Date().getFullYear() : endValue); + let duration = endValue * intervalTime / incrementation; + console.log(duration); + console.log((endValue === undefined || endValue === 0 ? new Date().getFullYear() : endValue)); let animation = setInterval(function() { duration -= intervalTime; - item.innerHTML = pad(parseInt(item.innerHTML) + 1, 4); + let val = parseInt(item.innerHTML); + item.innerHTML = pad( (val + incrementation > endValue ? val + (endValue - val) : val + incrementation), 4); if(duration <= 0) clearInterval(animation); }, intervalTime); diff --git a/view/fr/index.html b/view/fr/index.html index 0309572..19de8eb 100644 --- a/view/fr/index.html +++ b/view/fr/index.html @@ -52,7 +52,7 @@