Template:Kyoto/small countdown

From 2014.igem.org

(Difference between revisions)
(Created page with "<html> <a id="kyoto_alert" target="_blank" href="https://2013.igem.org/Team:Kyoto/TimeLimit">count down</a> <style type="text/css"> #kyoto_alert { position: fixed; top: 30px; ...")
Line 29: Line 29:
     date.getUTCSeconds()
     date.getUTCSeconds()
   );
   );
-
   var freeze = Date.UTC(2014, 8, 28, 4, 0, 0); // TODO
+
   var freeze = Date.UTC(2014, 10, 18, 4, 0, 0);
   time = (freeze - time)/1000;
   time = (freeze - time)/1000;
   if (time < 1 * 3600) {
   if (time < 1 * 3600) {
Line 36: Line 36:
     countdown.style.color = "#ff0";
     countdown.style.color = "#ff0";
   }
   }
-
   if (time >= 0) {
+
   if (time < 0) {
-
     var second = ('0' + (time % 60)).slice(-2);
+
    countdown.style.display = "none";
-
    time = Math.floor(time / 60);
+
  } else {
-
    var minute = ('0' + (time % 60)).slice(-2);
+
    var str;
-
    time = Math.floor(time / 60);
+
    if (time > 4 * 24 * 3600) {
-
    var hour = ('0' + (time)).slice(-2);
+
      var odd = (time%60)%2;
-
    var str = hour + " : " + minute + " : " + second;
+
      time = Math.floor(time / 60);
-
     str = "To Be Determined"
+
      var minute = ('0' + (time % 60)).slice(-2);
 +
      time = Math.floor(time / 60);
 +
      var hour = ('0' + (time)).slice(-2);
 +
      time = Math.floor(time / 24);
 +
      day = ('0' + (time)).slice(-2);
 +
      str = day + " : " + hour + " : " + minute;
 +
     } else {
 +
      var second = ('0' + (time % 60)).slice(-2);
 +
      time = Math.floor(time / 60);
 +
      var minute = ('0' + (time % 60)).slice(-2);
 +
      time = Math.floor(time / 60);
 +
      var hour = ('0' + (time)).slice(-2);
 +
      str = hour + " : " + minute + " : " + second;
 +
     }
     countdown.innerText = str;
     countdown.innerText = str;
     countdown.style.display = "block";
     countdown.style.display = "block";
-
  } else {
 
-
    countdown.style.display = "none";
 
   }
   }
}, 200);
}, 200);
</script>
</script>
</html>
</html>

Revision as of 08:14, 23 May 2014

count down