-
Notifications
You must be signed in to change notification settings - Fork 0
/
odpocet.html
115 lines (111 loc) · 3.77 KB
/
odpocet.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SILVESTR 2022</title>
<link rel="stylesheet" href="./style2.css">
</head>
<body>
<div class="wrapper">
<div class="container text-center">
<div class="header">
<h1 id="header" class="">Nový rok za:</h1>
</div>
<div class="nevimuz">
<div class="col-md-3 col-xs-6">
<div class="clock">
<div class="well">
<div id="days" class="num">00</div>
</div>
<div class="well">
<div id="days-text" class="text">Dní</div>
</div>
</div>
</div>
<div class="col-md-3 col-xs-6">
<div class="clock">
<div class="well">
<div id="hours" class="num">00</div>
</div>
<div class="well">
<div id="hours-text" class="text">Hodin</div>
</div>
</div>
</div>
<div class="col-md-3 col-xs-6">
<div class="clock">
<div class="well">
<div id="mins" class="num">00</div>
</div>
<div class="well">
<div id="mins-text" class="text">Minut</div>
</div>
</div>
</div>
<div class="col-md-3 col-xs-6">
<div class="clock">
<div class="well">
<div id="secs" class="num">00</div>
</div>
<div class="well">
<div id="secs-text" class="text">Sekund</div>
</div>
</div>
</div>
</div>
<div id="info" class="small"></div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>
function timeLeft(endtime){
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor( (t/1000) % 60 );
var minutes = Math.floor( (t/1000/60) % 60 );
var hours = Math.floor( (t/(1000*60*60)) % 24 );
var days = Math.floor( t/(1000*60*60*24) );
return {
'total': t,
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
};
};
$(document).ready(function() {
var today = new Date();
var deadline = 'January 1 ' + (today.getFullYear() + 1) + " 00:00:00";
if (today.getMonth() == 0 && today.getDate() == 1) {
deadline = 'January 1 ' + (today.getFullYear()) + " 00:00:00";
};
var setClock = function(newyear){
var timeinterval = setInterval(function(){
var t = timeLeft(newyear);
$('#days').text(t.days);
$('#hours').text(t.hours);
$('#mins').text(('0' + t.minutes).slice(-2));
$('#secs').text(('0' + t.seconds).slice(-2));
if(t.total<=0){
clearInterval(timeinterval);
var now = new Date();
var yearStr = now.getFullYear().toString();
$('#header').text("Šťastný nový rok!!!");
$('#days').text(yearStr[0]);
$('#days-text').text("Šťastný");
$('#hours').text(yearStr[1]);
$('#hours-text').text("nový");
$('#mins').text(yearStr[2]);
$('#mins-text').text("rok");
$('#secs').text(yearStr[3]);
$('#secs-text').text("!");
$('#info').text("Odpočet začne zase ráno!");
}
},100);
};
setClock(deadline);
});
</script>
</body>
</html>