Guest User

Untitled

a guest
Nov 22nd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. (function($) {
  2. var launch = new Date(2018, 01, 14, 11, 00);
  3. var message = $('#message');
  4. var days = $('#days');
  5. var hours = $('#hours');
  6. var minutes = $('#minutes');
  7. var seconds = $('#seconds');
  8. setDate();
  9. function setDate(){
  10. var now = new Date();
  11. if( launch < now ){
  12. days.html('<h1>0</h1><p>Day</p>');
  13. hours.html('<h1>0</h1><p>Hour</p>');
  14. minutes.html('<h1>0</h1><p>Minute</p>');
  15. seconds.html('<h1>0</h1><p>Second</p>');
  16. message.html('{{ settings.coming_soon_text }}');
  17. }
  18. else{
  19. var s = -now.getTimezoneOffset()*60 + (launch.getTime() - now.getTime())/1000;
  20. var d = Math.floor(s/86400);
  21. days.html('<h1>'+d+'</h1><p>Day'+(d>1?'s':''),'</p>');
  22. s -= d*86400;
  23.  
  24. var h = Math.floor(s/3600);
  25. hours.html('<h1>'+h+'</h1><p>Hour'+(h>1?'s':''),'</p>');
  26. s -= h*3600;
  27.  
  28. var m = Math.floor(s/60);
  29. minutes.html('<h1>'+m+'</h1><p>Minute'+(m>1?'s':''),'</p>');
  30.  
  31. s = Math.floor(s-m*60);
  32. seconds.html('<h1>'+s+'</h1><p>Second'+(s>1?'s':''),'</p>');
  33. setTimeout(setDate, 1000);
  34.  
  35. message.html('{{ settings.coming_soon_text }}');
  36. }
  37. }
  38. })(jQuery);
Add Comment
Please, Sign In to add comment