frozenLake

Clock

Mar 26th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. <html>
  2. <body>
  3. <style type="text/css"> /* I got some /style/ */
  4. body {background-color:#BACAFE;} /* Do I need to explain this one? */
  5. p {color:#010101; /* Well I can't just leave BACAFE by itself, now can I? */
  6. text-align:center; /* This aligns the text in the center of whatever box it is in. */
  7. }
  8. #splanet_block
  9. { /* This is the CSS for the Starter Planet Clock. */
  10. width:200px;
  11. border:4px solid #FFC000; /* Attempt at making a shade of gold */
  12. margin:auto; /* This centers the block in the screen, might change this later. */
  13. background-color:#DCC57F; /* Halfway Blend between gold and BACAFE. */
  14. }
  15. #splanet_village
  16. {
  17. text-align:left
  18. }
  19. #v0earth_block
  20. { /* This is the CSS for the Earth Clock... with timing to events on other planets */
  21. width:650px;
  22. border:4px solid #0000FF; /* Blue. */
  23. margin:auto; /* This centers the block in the screen, might change this later. */
  24. background-color:#5D65FF; /* Halfway Blend between Blue and BACAFE. */
  25. }
  26. #unix_block
  27. { /* This is the CSS for the Unix Clock. */
  28. width:200px;
  29. border:4px solid #000000; /* Black. */
  30. margin:auto; /* This centers the block in the screen, might change this later. */
  31. background-color:#5D657F; /* Halfway Blend between Black and BACAFE. */
  32. }
  33.  
  34. </style>
  35. <script>
  36. var myVar=setInterval(function(){univeral_loop()},1000); // It actually would check every millisecond if that 1000 was not there. //
  37.  
  38. function univeral_loop()
  39. {
  40. var unix = Math.round(+new Date() / 1000);
  41. var splanet_year = Math.floor((unix-1387670400)/38750400); // splanet stands for Starter Planet, obviously. //
  42. var splanet_yrem = ((unix-1387670400) % 38750400);
  43. var splanet_day = Math.floor(splanet_yrem / 93600);
  44. var splanet_drem = splanet_yrem % 93600;
  45. var splanet_hour = Math.floor(splanet_drem / 3600);
  46. var splanet_hrem = splanet_drem % 3600;
  47. var splanet_min = Math.floor(splanet_hrem / 60);
  48. var splanet_sec = splanet_hrem % 60;
  49. if (splanet_sec<10)
  50. {
  51. splanet_secmin=":0";
  52. }
  53. else
  54. {
  55. splanet_secmin=":";
  56. }
  57.  
  58. if (splanet_min<10)
  59. {
  60. splanet_hourmin=":0";
  61. }
  62. else
  63. {
  64. splanet_hourmin=":";
  65. }
  66. document.getElementById('splanet_dayname').innerHTML = "Day " + splanet_day + " of Year " + splanet_year;
  67. document.getElementById('splanet_clock').innerHTML = "The time is " + splanet_hour + splanet_hourmin + splanet_min + splanet_secmin + splanet_sec;
  68.  
  69. var UTCdate = new Date();
  70. var earthdate = UTCdate.toUTCString();
  71. document.getElementById('v0earth_gmt').innerHTML = earthdate;
  72.  
  73.  
  74. var splanet_vanyear = Math.floor((unix-1387670400)/38750400);
  75. var splanet_vanyear2 = Math.floor(38750400+38750400*splanet_vanyear);
  76. var splanet_vanyear3 = Math.floor(splanet_vanyear2-(unix-1387670400));
  77. var vanyear_day = Math.floor(splanet_vanyear3 / 86400);
  78. var vanyear_drem = splanet_vanyear3 % 86400;
  79. var vanyear_hour = Math.floor(vanyear_drem / 3600);
  80. var vanyear_hrem = vanyear_drem % 3600;
  81. var vanyear_min = Math.floor(vanyear_hrem / 60);
  82. var vanyear_sec = vanyear_hrem % 60;
  83. document.getElementById('splanet_newyear').innerHTML = vanyear_day + " Days, " + vanyear_hour + " Hours, " + vanyear_min + " Minutes, and " + vanyear_sec + " Seconds " + "until Year " + (splanet_year+1) + " on Starter Planet.";
  84. document.getElementById('unix_clock').innerHTML = unix;
  85. }
  86.  
  87. </script>
  88.  
  89. <!--
  90.  
  91. I used to have a method for doing 1st, 2nd, ect, but it broke so I got rid of it. Here, have it.
  92.  
  93. if (day>13)
  94. {
  95. var dcal=day%10
  96. }
  97. else
  98. {
  99. var dcal=day
  100. }
  101. if (dcal=1)
  102. {
  103. var nend="st"
  104. }
  105. else if (dcal=2)
  106. {
  107. var nend="nd"
  108. }
  109. else if (dcal=3)
  110. {
  111. var nend="rd"
  112. }
  113. else
  114. {
  115. var nend="th"
  116. }
  117.  
  118. -->
  119. <div id=v0earth_block>
  120. <p><b>Vanilla Earth</b></p>
  121. <p id="v0earth_gmt"></p>
  122. <p id="splanet_newyear"></p>
  123. </div>
  124. <p>
  125. <div id=splanet_block>
  126. <p><b>Starter Planet</b></p>
  127. <p id="splanet_dayname"></p>
  128. <p id="splanet_clock"></p>
  129. <p id="splanet_village">Sunrise: 6 to 7<br>Noon: 13<br>Sunset: 19 to 20<br>Midnight: 26
  130. </p>
  131. </div>
  132. <p>
  133. <div id=unix_block>
  134. <p><b>Unix Time</b></p>
  135. <p id="unix_clock"></p>
  136. </div>
  137. </body>
  138. </html>
Advertisement
Add Comment
Please, Sign In to add comment