forked from HampusDahlin/beerclock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.html
More file actions
90 lines (73 loc) · 1.53 KB
/
Copy pathmain.html
File metadata and controls
90 lines (73 loc) · 1.53 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
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> øhltajm!</title>
<style>
body {
margin: 0;
height: 100vh;
overflow: hidden;
background: url("beer_foam.jpg");
background-size: cover;
background-position: 50% calc(clamp(0, calc(42 - (100vh * 42 / 1200px)), 42) * 1%);
background-repeat: no-repeat;
}
div {
padding: 0;
margin: 0;
}
main {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.center {
margin-left: auto;
margin-right: auto;
text-align: center;
font-family: default;
}
</style>
<script>
function startTime() {
var today=new Date();
var h = 17 - today.getHours();
var m = 60 - today.getMinutes();
var s = 60 - today.getSeconds();
if(today.getHours() < 17 && today.getHours() > 5){
document.getElementById('addition').innerHTML = "Till øhl";
}else{
h = 1;
m = 1;
s = 1;
document.getElementById('addition').innerHTML = "Dags för øhl";
}
if(s != 0){
h = h-1;
}
var stringH = getTimeString(h);
var stringM = getTimeString(m-1);
var stringS = getTimeString(s-1);
document.getElementById('txt').innerHTML = stringH+":"+stringM+":"+stringS;
var t = setTimeout(function(){startTime()},500);
}
function getTimeString(time){
if(time < 11){
return "0" + time;
}else{
return "" + time;
}
}
</script>
</head>
<body onload="startTime()">
<main>
<div id="txt" class="center" style="font-size: 25vw;"></div>
<div id="addition" class="center" style="font-size: 10vw;"></div>
</main>
</body>
</html>