-##{@url.url}
-#Opening the awesome event now!
%h1.text-center
#countdown
%h2.text-center
until
%h2.text-center
= URI.unescape(@time[8])
%hr
%h3.lead.white
%strong Countdown Details:
Date: #{@time[4].gsub!('~',' ')}
Alert: Yes
:javascript
var end = new Date('#{@date.insert(6, '20')}');
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining() {
var now = new Date();
var distance = end - now;
if (distance < 0) {
clearInterval(timer);
document.getElementById('countdown').innerHTML = 'EXPIRED!';
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
document.getElementById('countdown').innerHTML = days + ' Days
';
document.getElementById('countdown').innerHTML += hours + ' Hours
';
document.getElementById('countdown').innerHTML += minutes + ' Minutes
';
document.getElementById('countdown').innerHTML += seconds + ' Seconds';
}
timer = setInterval(showRemaining, 1000);