Advertisement
Finessed

mybb board close (Countdown)

Mar 30th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <style>
  2. .refreshButton {
  3.     background-color: #1A1A1A;
  4.     border: none;
  5.     color: #fff;
  6.     padding: 8px 16px;
  7.     text-align: center;
  8.     display: inline-block;
  9.     transition-duration: 0.4s;
  10.     border: 2px solid #005F82;
  11.   }
  12.  
  13.   .refreshButton:hover {
  14.     background-color: #0077A3;
  15.     color: #fff;
  16.     border: 2px solid #1A1A1A;  
  17.   }
  18. </style>
  19.  
  20. <center><h2>We are currently closed for maintenance, check back when the timer runs out!</h2><h2 id="countdown">0d 0h 00m 00s</h2></center>
  21.  
  22. <script>
  23. // Countdown Date
  24. var countDownDate = new Date("Mar 30, 2020 05:35:25").getTime();
  25.  
  26. var x = setInterval(function() {
  27.   var now = new Date().getTime();
  28.   var distance = countDownDate - now;
  29.  
  30.   var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  31.   var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  32.   var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  33.   var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  34.  
  35.   document.getElementById("countdown").innerHTML = days + "d " + hours + "h "
  36.   + minutes + "m " + seconds + "s ";
  37.  
  38.   if (distance < 0) {
  39.     clearInterval(x);
  40.     document.getElementById("countdown").innerHTML = "<input class=\"refreshButton\" type=\"button\" value = \"Refresh\" onclick=\"history.go(0)\" />";
  41.   }
  42. }, 1000);
  43. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement