1 line
No EOL
911 B
JavaScript
1 line
No EOL
911 B
JavaScript
const countdown=document.getElementById("countdown"),counter=document.getElementById("counter"),daysContainer=document.getElementById("days"),hoursContainer=document.getElementById("hours"),minutesContainer=document.getElementById("minutes"),secondsContainer=document.getElementById("seconds");let shown=!1;const enableReload=-1===window.location.pathname.indexOf("c");function render(){let e=new Date,n=openDate-e;var t=6e4,o=36e5,a=864e5,d=Math.floor(n/a),r=Math.floor(n%a/o),l=Math.floor(n%o/t),i=Math.floor(n%t/1e3);d=String(d).length>=2?d:"0"+d,r=String(r).length>=2?r:"0"+r,l=String(l).length>=2?l:"0"+l,i=String(i).length>=2?i:"0"+i,openDate<=e&&enableReload?window.location.reload(!1):(daysContainer.textContent=d,hoursContainer.textContent=r,minutesContainer.textContent=l,secondsContainer.textContent=i),shown||setTimeout(()=>{countdown.style.opacity=1,shown=!0},300)}render(),setInterval(render,1e3); |