-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
80 lines (74 loc) · 1.67 KB
/
index.html
File metadata and controls
80 lines (74 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<title>Binary millitary time</title>
<link href='https://fonts.googleapis.com/css?family=Inconsolata:700' rel='stylesheet' type='text/css'>
<style type="text/css">
body,html {
background-color:#000000;
margin: 0;
padding: 0;
text-align: center;
height: 100%;
font-family: 'Inconsolata';
color:#ff0000;
}
.centered {
position: absolute;
top: 50%;
margin-top: -75px;
left: 0px;
right: 0px;
}
.binary_style {
display: block;
width: 100%;
font-size:50px;
line-height: 40px;
}
.cr
{
position: absolute;
bottom: 0;
right: 0;
padding-right: 10px;
padding-bottom: 10px;
}
</style>
</head>
<body>
<div class="centered">
<span id="seconds" class="binary_style">000000</span>
<span id="minutes" class="binary_style">000000</span>
<span id="hours" class="binary_style"> 00000</span>
</div>
<span class="cr">© Adam Westman 2015</span>
<script type="text/javascript">
var $seconds = document.getElementById("seconds");
var $minutes = document.getElementById("minutes");
var $hours = document.getElementById("hours");
function to_binary_str(numbers, limit)
{
var txt = "";
while(limit >= 1)
{
txt += numbers >= limit ? 1 : 0;
numbers %= limit;
limit = Math.floor(limit / 2);
}
return txt;
}
function update_binary(seconds, minutes, hours)
{
$seconds.innerHTML = to_binary_str(seconds, 32)
$minutes.innerHTML = to_binary_str(minutes, 32)
$hours.innerHTML = to_binary_str(hours, 16)
}
var timer = setInterval(function()
{
var d = new Date();
update_binary(d.getSeconds(), d.getMinutes(), d.getHours());
}, 16);
</script>
</body>
</html>