-
Notifications
You must be signed in to change notification settings - Fork 0
/
sls_small_clock.html
97 lines (83 loc) · 2.59 KB
/
sls_small_clock.html
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
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SLS JS CLOCK</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<style>
@font-face {
font-family: 'DinCompPro-Med';
src: url('fonts/PFDinTextCompPro-Medium.eot');
src: url('fonts/PFDinTextCompPro-Medium.eot?#iefix') format('embedded-opentype'),
url('fonts/PFDinTextCompPro-Medium.woff2') format('woff2'),
url('fonts/PFDinTextCompPro-Medium.woff') format('woff'),
url('fonts/PFDinTextCompPro-Medium.ttf') format('truetype'),
url('fonts/PFDinTextCompPro-Medium.svg#PFDinTextCompPro-Medium') format('svg');
font-weight: normal;
font-style: normal;
}
body {
line-height: 1;
}
.clock-box {
top: 4vh;
right: 5vh;
position: absolute;
font-size: 6vh;
font-family: 'DinCompPro-Med';
text-shadow: #000 1px 1px 5px;
color: #fff;
opacity: 0.7;
display: flex;
flex-flow: column nowrap;
align-items: center;
}
.clock-time {
display: flex;
justify-content: center;
}
.clock-timezone {
font-size: 4vh;
}
</style>
<script src="js/luxon.min.js"></script>
<script>
$(document).ready(function () {
function setTime() {
let now = timezone ? DateTime.now().setZone(timezone) : DateTime.now()
let minutes = now.minute
// Add a leading zero to the minutes value
$(".min").html((minutes < 10 ? "0" : "") + minutes)
let hours = now.hour
// Add a leading zero to the hours value
$(".hours").html((hours < 10 ? "0" : "") + hours)
}
var DateTime = luxon.DateTime;
const getParams = window.location.search;
const params = new URLSearchParams(getParams);
const timezone = params.get('timezone') || 'Europe/Berlin';
const city = timezone.split('/')[1]
// Set timezone city
$('.clock-timezone').html(city);
// Make the ':' symbol blink
(function blink() {
$('.colon').fadeOut(1500).fadeIn(1500, blink);
})();
// Update time
setTime()
setInterval(setTime, 1000);
});
</script>
</head>
<body>
<div class="clock-box">
<span class="clock-time">
<span class="hours">00</span>
<span class="colon">:</span>
<span class="min">00</span>
</span>
<div class="clock-timezone">Königsberg</div>
</div>
</body>
</html>