Add counter
This commit is contained in:
parent
81bbeb5bfb
commit
c9ad067ef9
|
@ -0,0 +1,20 @@
|
|||
// All Unix time values are in milliseconds (ms)
|
||||
const UnixDay = 86400000;
|
||||
const UnixYear = 31536000000;
|
||||
const BirthTime = 1082713500000;
|
||||
|
||||
function UnixTime() {
|
||||
let DateNow = Date.now();
|
||||
let TimeSinceBirth = DateNow - BirthTime;
|
||||
let YearsSinceBirth = TimeSinceBirth / UnixYear;
|
||||
let LeapYears = ~~(YearsSinceBirth / 4);
|
||||
return DateNow - UnixDay*LeapYears;
|
||||
}
|
||||
|
||||
function UnixAgeNow() {
|
||||
return UnixTime() - BirthTime;
|
||||
}
|
||||
|
||||
function UnixToYears() {
|
||||
return UnixAgeNow() / UnixYear;
|
||||
}
|
|
@ -13,6 +13,7 @@
|
|||
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
|
||||
<link href="Assets/CSS/Dark.css" rel="stylesheet">
|
||||
<script src="Assets/JS/RandomGIF.js"></script>
|
||||
<script src="Assets/JS/CurrentAge.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -25,9 +26,20 @@
|
|||
<h4><a href="FumoPrisms/">Fumo Prisms (!)</a></h4>
|
||||
<br>
|
||||
<h4><a href="WebPinBoard/">My WebPinBoard</a></h4>
|
||||
<br>
|
||||
</p>
|
||||
<div>
|
||||
<p id="CurrentAge"></p>
|
||||
<noscript><p>There should be a ticking clock here, but your browser isn't loading the JavaScript.</p></noscript>
|
||||
</div>
|
||||
<br><br><br>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var CurrentAgeText = document.getElementById("CurrentAge").textContent;
|
||||
const CurrentAgeRefresh = 50;
|
||||
setInterval(
|
||||
function() {CurrentAgeText = "Currently" + UnixToYears() + ".."},
|
||||
CurrentAgeRefresh);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue