From Dark and Darker Wiki

No edit summary
No edit summary
Line 35: Line 35:
    
    
function countdownTimer() {
function countdownTimer() {
  // set the date and time for the countdown
   var countDownDate = new Date("2023-02-06T18:00:00Z").getTime();
   var countDownDate = new Date("2023-02-06T18:00:00Z").getTime();
  // update the countdown every second
   var x = setInterval(function() {
   var x = setInterval(function() {
    // get the current time
     var now = new Date().getTime();
     var now = new Date().getTime();
    // calculate the distance between now and the countdown date
     var distance = countDownDate - now;
     var distance = countDownDate - now;
    // calculate the days, hours, minutes, and seconds
     var days = Math.floor(distance / (1000 * 60 * 60 * 24));
     var days = Math.floor(distance / (1000 * 60 * 60 * 24));
     var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
     var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
     var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
     var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
     var seconds = Math.floor((distance % (1000 * 60)) / 1000);
     var seconds = Math.floor((distance % (1000 * 60)) / 1000);
    // if the countdown has expired, display "LIVE NOW"
     if (distance < 0) {
     if (distance < 0) {
       clearInterval(x);
       clearInterval(x);
       document.getElementById("timer").innerHTML = "LIVE NOW";
       document.getElementById("timer").innerHTML = "LIVE NOW";
    } else {
      document.getElementById("timer").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
     }
     }
   }, 1000);
   }, 1000);
}
}

Revision as of 04:42, 9 January 2023

/* Any JavaScript here will be loaded for all users on every page load. */


  const ctx = document.getElementById('myChart');

  new Chart(ctx, {
    type: 'bar',
    data: {
  labels: labels,
  datasets: [{
    label: 'My First Dataset',
    data: [{
                x: 1,
                y: 0.5
            }, {
                x: 2,
                y: 60
            }, {
                x: 3,
                y: 20
            }],
    fill: false,
    borderColor: 'rgb(75, 192, 192)',
    tension: 0.1
  }]
},
    options: {
      scales: {
        y: {
          beginAtZero: true
        }
      }
    }
  });
  
function countdownTimer() {
  var countDownDate = new Date("2023-02-06T18:00:00Z").getTime();
  var x = setInterval(function() {
    var now = new Date().getTime();
    var distance = countDownDate - now;
    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
    if (distance < 0) {
      clearInterval(x);
      document.getElementById("timer").innerHTML = "LIVE NOW";
    } else {
      document.getElementById("timer").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s ";
    }
  }, 1000);
}