Silox13

Untitled

Aug 26th, 2018
74
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <style>
  6. p {
  7. text-align: center;
  8. font-size: 60px;
  9. margin-top: 0px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14.  
  15. <p id="countdown"></p>
  16.  
  17. <script>
  18. function wait(ms) {
  19. var d = new Date();
  20. var d2 = null;
  21. do { d2 = new Date(); }
  22. while(d2-d < ms);
  23. }
  24.  
  25. // Set the date we're counting down to
  26.  
  27. var countDownDate = new Date("Aug 26, 2018 00:00:00 EDT").getTime();
  28.  
  29. var times = ["Aug 26, 2018 18:44:00 EDT", "Aug 26, 2018 20:26:00 EDT", "Aug 26, 2018 22:09:00 EDT", "Aug 26, 2018 23:52:00 EDT", "Aug 27, 2018 01:35:00 EDT", "Aug 27, 2018 03:18:00 EDT", "Aug 27, 2018 05:01:00 EDT", "Aug 27, 2018 06:44:00 EDT", "Aug 27, 2018 08:27:00 EDT", "Aug 27, 2018 10:10:00 EDT", "Aug 27, 2018 11:53:00 EDT", "Aug 27, 2018 13:36:00 EDT"]
  30. var index = -1
  31.  
  32. // Get todays date and time
  33. var now = new Date().getTime();
  34.  
  35. // Find the distance between now and the count down date
  36. var distance = countDownDate - now;
  37.  
  38. while (distance < 0) {
  39. index += 1
  40.  
  41. countDownDate = new Date(times[index]).getTime();
  42.  
  43. distance = countDownDate - now;
  44. }
  45.  
  46. // Update the count down every 1 second
  47. var x = setInterval(function() {
  48.  
  49. // Get todays date and time
  50. var now = new Date().getTime();
  51.  
  52. // Find the distance between now and the count down date
  53. var distance = countDownDate - now;
  54.  
  55. // Time calculations for days, hours, minutes and seconds
  56. var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  57. var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  58. var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  59.  
  60. // Output the result in an element with id="demo"
  61. document.getElementById("countdown").innerHTML = hours + "h "
  62. + minutes + "m " + seconds + "s ";
  63.  
  64. console.log(distance)
  65.  
  66. if (distance < 0) {
  67. document.getElementById("countdown").innerHTML = "Cube Time!";
  68. }
  69. if (distance < -19000) {
  70. index += 1
  71. countDownDate = new Date(times[index]).getTime();
  72. }
  73. }, 1000);
  74. </script>
  75.  
  76. </body>
  77. </html>
RAW Paste Data