-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
125 lines (108 loc) · 2.99 KB
/
index.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
116
117
118
119
120
121
122
123
124
125
<html>
<head>
<title>30.</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
</head>
<style>@font-face {
font-family: myFirstFont;
src: url("https://excalidraw.com/Virgil.woff2");
}
div {
font-family: myFirstFont;
}
body,
html {
padding: 0;
margin: 0;
}
.background {
text-align: center;
color: #343a40;
font-family: Verdana;
}
h1 {
margin-bottom: 40px;
font-size: 50px;
font-weight: 100;
}
.content {
margin-top: 40px;
display: block;
padding: 0 0;
/*background: rgba(0, 0, 0, 0.4);*/
width: 100%;
}
#counter {
font-size: 50px;
margin-bottom: 30px
}
</style>
<body class="background">
<div class="content">
<object data="zapro.svg" style="max-width:100%;width:642px" type="image/svg+xml">
</object>
</div>
<div class="content" id="countdown">
<div id="counter"><span>Jeszcze: </span><span id="c-day"></span><span id="c-hour"></span><span id="c-min"></span><span id="c-sec"></span></div>
</div>
</body>
<script>// set the date we're counting down to
var target_date = new Date('Nov 20, 2021, 14:01:00').getTime();
// variables for time units
var days, hours, minutes, seconds;
// get tag element
var countdownDay = document.getElementById("c-day");
var countdownHour = document.getElementById("c-hour");
var countdownMin = document.getElementById("c-min");
var countdownSec = document.getElementById("c-sec");
window.polishPlurals=function (singularNominativ, pluralNominativ, pluralGenitive, value) {
if (value === 1) {
return singularNominativ;
} else if (value % 10 >= 2 && value % 10 <= 4 && (value % 100 < 10 || value % 100 >= 20)) {
return pluralNominativ;
} else {
return pluralGenitive;
}
}
// update the tag with id "countdown" every 1 second
function upd()
{
// find the amount of "seconds" between now and target
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
// do some time calculations
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
if (seconds_left<=0)
{
document.getElementById("countdown").style.display = "none";
clearInterval(window._int);
console.log("d");
}
else
{
// format countdown string + set tag value
if (days > 0)
countdownDay.innerHTML = days + " " + window.polishPlurals("dzień", "dni", "dni", days) +", ";
else
countdownDay.innerHTML = "";
if (hours > 0 || days > 0) {
countdownHour.innerHTML = hours + " "+ window.polishPlurals("godzina", "godziny", "godzin", hours) +" i ";
} else {
countdownHour.innerHTML = "";
}
if (seconds_left > 60) {
countdownMin.innerHTML = minutes +" "+ window.polishPlurals("minuta", "minuty", "minut", minutes);
} else {
countdownMin.innerHTML = "mniej niż minuta";
}
}
}
upd();
window._int=setInterval(upd, 1000);
</script>
</html>