forked from Dmitriy-4/f76map
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.html
More file actions
141 lines (130 loc) · 4.08 KB
/
Copy pathclock.html
File metadata and controls
141 lines (130 loc) · 4.08 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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Platypus clock</title>
<style>
html, body {width: 100%; height: 100%; margin: 0;}
#main {position: absolute; top: calc(50% - 381px); left: calc(50% - 315px); padding: 10px;}
/* #main {border: 3px solid black;} */
#strelka1 {position: absolute; top: 148px; left: 303px; transform-origin: 13px 215px; z-index: 100;}
#strelka2 {position: absolute; top: 201px; left: 301px; transform-origin: 15px 162px;}
#text, #text2 {text-align: center; font-size: 28pt;}
</style>
</head>
<body>
<div id="main">
<div id="text"></div>
<img src="platypus_clock/clock.png">
<div id="strelka1"><img src="platypus_clock/str1.png"></div>
<div id="strelka2"><img src="platypus_clock/str2.png"></div>
<div id="text2"></div>
</div>
<script>
let date = new Date();
function ust_strelki() {
date = new Date();
strelka1.style.transform = "rotate("+date.getMinutes()*6+"deg)";
strelka2.style.transform = "rotate("+[date.getHours()*30+date.getMinutes()*0.5]+"deg)";
let aa;
let a = date.getMinutes().toString().slice(-1);
let a2 = date.getMinutes();
if (a == 1) {
if (a2 == 11) {
aa = "минУТЬ"
}
else {
aa = "минУТЯ"
}
}
else if (a == 2 || a == 3 || a == 4) {
if (a2 == 12 || a2 == 13 || a2 == 14) {
aa = "минУТЬ"
}
else {
aa = "минУТИ"
}
}
else {
aa = "минУТЬ"
}
let bb;
let b = date.getHours().toString().slice(-1);
let b2 = date.getHours();
if (b == 1) {
if (b2 == 11) {
bb = "чОсов"
}
else {
bb = "чОс"
}
}
else if (b == 2 || b == 3 || b == 4) {
if (b2 == 12 || b2 == 13 || b2 == 14){
bb = "чОсов"
}
else {
bb = "чОса"
}
}
else {
bb = "чОсов"
}
let text1 = "Сейчас "+date.getHours()+" "+bb+" и "+date.getMinutes()+" "+aa;
text.innerHTML = text1;
test_timer();
}
ust_strelki();
setInterval(ust_strelki, 10000);
function test_timer() {
let vt = "";
if (date.getDay() == 0) {vt = 2}
else if (date.getDay() == 1) {vt = 1}
else if (date.getDay() == 2) {
if (date.getHours() < 19) {vt = 0}
else {vt = 7}
}
else if (date.getDay() == 3) {vt = 6}
else if (date.getDay() == 4) {vt = 5}
else if (date.getDay() == 5) {vt = 4}
else if (date.getDay() == 6) {vt = 3}
let end = new Date(date.getFullYear(),date.getMonth(),date.getDate()+vt, 19, 0, 0);
let ost = end-date
let sec = 1000;
let min = sec * 60;
let hour = min * 60;
let day = hour * 24;
let days = Math.floor(ost / day);
let hours = Math.floor((ost % day) / hour);
let minutes = Math.floor((ost % hour) / min);
let days_t = "";
if (days == 1) {days_t = "день"}
else if (days == 2 || days == 3 || days == 4) {days_t = "дЫня"}
else {days_t = "дЫней"}
let hours_t = "";
if (hours.toString().slice(-1) == 1) {
if (hours == 11) {hours_t = "чОсов"} else {hours_t = "чОс"}
}
else if (hours.toString().slice(-1) == 2 || hours.toString().slice(-1) == 3 || hours.toString().slice(-1) == 4) {
if (hours == 12 || hours == 13 || hours == 14){hours_t = "чОсов"} else {hours_t = "чОса"}
}
else {hours_t = "чОсов"}
let minutes_t = "";
if (minutes_t == 1) {
if (minutes == 11) {minutes_t = "минУТЬ"} else {minutes_t = "минУТЯ"}
}
else if (minutes.toString().slice(-1) == 2 || minutes.toString().slice(-1) == 3 || minutes.toString().slice(-1) == 4) {
if (minutes == 12 || minutes == 13 || minutes == 14) {minutes_t = "минУТЬ"} else {minutes_t = "минУТИ"}
} else {minutes_t = "минУТЬ"}
let text_2 = "";
if (days == 0) {
if (hours == 0) {text_2 = "До хЫрени в атомшопе<br>"+minutes+" "+minutes_t;}
else {text_2 = "До хЫрени в атомшопе<br>"+hours+" "+hours_t+" и "+minutes+" "+minutes_t;}
}
else {text_2 = "До хЫрени в атомшопе<br>"+days+" "+days_t+" "+hours+" "+hours_t+" и "+minutes+" "+minutes_t;}
text2.innerHTML = text_2;
}
test_timer();
</script>
</body>
</html>