-##{@url.url} -#Opening the awesome event now! %h1.text-center
#countdown
%h2.text-center
- if @expired == true Since - else Until
%h2.text-center
= URI.unescape(@time[8])
%hr %h3.lead.white %strong Countdown Details: Date: #{@time[4].gsub!('~',' ')} - Alert Set: #{@alert} %h3.text-center #device :javascript var end = new Date('#{@date}'); var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; var timer; function showRemaining() { var now = new Date(); var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent ); var distance = end - now; if (distance < 0) { 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); var neg_days = Math.abs(days) var neg_hours = Math.abs(hours) var neg_minutes = Math.abs(minutes) var net_seconds = Math.abs(seconds) if (iOS == true) { document.getElementById('device').innerHTML = ' Open in Tminus '; } document.getElementById('countdown').innerHTML = neg_days + ' Days
'; document.getElementById('countdown').innerHTML += neg_hours + ' Hours
'; document.getElementById('countdown').innerHTML += neg_minutes + ' Minutes
'; document.getElementById('countdown').innerHTML += neg_seconds + ' Seconds'; 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'; if (iOS == true) { document.getElementById('device').innerHTML = ' Open in Tminus '; } } timer = setInterval(showRemaining, 1000);