-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
executable file
·270 lines (217 loc) · 7.54 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- Primary Meta Tags -->
<title>เมื่อไหร่ประยุทธ์จะออกไป?</title>
<meta name="title" content="เมื่อไหร่ประยุทธ์จะออกไป?" />
<meta name="description" content="นับเวลาถอยหลังถึงวันที่พลเอกประยุทธ์ จันทร์โอชา จะหมดวาระการเป็นนายกรัฐมนตรี" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://howlonguntilprayuthleaves.com" />
<meta property="og:title" content="เมื่อไหร่ประยุทธ์จะออกไป?" />
<meta property="og:description"
content="นับเวลาถอยหลังถึงวันที่พลเอกประยุทธ์ จันทร์โอชา จะหมดวาระการเป็นนายกรัฐมนตรี" />
<meta property="og:image" content="/prayuth.jpg" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://howlonguntilprayuthleaves.com" />
<meta property="twitter:title" content="เมื่อไหร่ประยุทธ์จะออกไป?" />
<meta property="twitter:description"
content="นับเวลาถอยหลังถึงวันที่พลเอกประยุทธ์ จันทร์โอชา จะหมดวาระการเป็นนายกรัฐมนตรี" />
<meta property="twitter:image" content="/prayuth.jpg" />
<link href="https://fonts.googleapis.com/css?family=Chonburi&display=swap" rel="stylesheet" />
<style>
body {
margin: 0;
font-family: 'Chonburi', 'Sukhumvit', -apple-system, BlinkMacSystemFont,
'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
'Helvetica Neue', 'Tahoma', sans-serif;
}
* {
box-sizing: border-box;
}
.heading a {
color: inherit;
text-decoration: none;
}
.heading {
color: #333;
text-align: center;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 1em;
}
.countdown {
display: grid;
grid-template-columns: repeat(6, 1fr);
grid-gap: 25px;
align-items: center;
justify-content: center;
margin: 30px 0;
}
.slot {
transition: all 1px ease-in-out;
text-align: center;
cursor: pointer;
color: #222;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}
.slot.slot.slot__highlight .label {
color: #eee;
}
.slot.slot__highlight {
background: #3b5171;
padding: 1em 1.8em;
color: white;
box-shadow: 0px 3px 8px rgba(59, 81, 113, 0.3);
}
.slot :first-child {
font-size: 4.5em;
font-weight: bold;
}
.slot .label {
font-size: 1.5em;
margin-top: 15px;
color: #333;
}
.i-love-prayuth {
position: fixed;
bottom: 0;
right: 0;
width: 35%;
margin-bottom: -10px;
}
@media (max-width: 830px) {
.countdown {
grid-template-columns: repeat(3, 1fr);
}
.slot :first-child {
font-size: 3.5em;
}
.heading {
font-size: 1.8em;
}
.i-love-prayuth {
position: relative;
margin-top: 50px;
width: 100%;
}
}
@media (max-width: 300px) {
.countdown {
grid-template-columns: repeat(2, 1fr);
}
.slot :first-child {
font-size: 2em;
}
.heading {
font-size: 1.2em;
}
}
.countup {
margin-top: 25px;
}
</style>
</head>
<body>
<div class="container">
<h1 class="heading">
<a href="https://howlonguntilprayuthleaves.com/">เมื่อไหร่ประยุทธ์จะออกไป?</a>
</h1>
<div class="countdown">
<div class="slot slot__highlight">
<div class="years">0</div>
<div class="label">ปี</div>
</div>
<div class="slot">
<div class="months">0</div>
<div class="label">เดือน</div>
</div>
<div class="slot">
<div class="days">0</div>
<div class="label">วัน</div>
</div>
<div class="slot">
<div class="hours">0</div>
<div class="label">ชั่วโมง</div>
</div>
<div class="slot">
<div class="minutes">0</div>
<div class="label">นาที</div>
</div>
<div class="slot">
<div class="seconds">0</div>
<div class="label">วินาที</div>
</div>
</div>
<h1 class="heading">ประยุทธ์เป็นนายกมาแล้ว</h1>
<div class="countup">
<div class="slot slot__highlight">
<div class="up-days">0</div>
<div class="label">วัน</div>
</div>
</div>
</div>
<img class="i-love-prayuth" src="prayuth_song.png">
<script>
const yearsEl = document.querySelector('.years')
const monthsEl = document.querySelector('.months')
const daysEl = document.querySelector('.days')
const hoursEl = document.querySelector('.hours')
const minutesEl = document.querySelector('.minutes')
const secondsEl = document.querySelector('.seconds')
const upDaysEl = document.querySelector('.up-days')
// First day of the NCPO coup: 22 พฤษภาคม 2557 เวลา 16:30 น.
const coupDate = new Date('05/22/2014 16:30:00 UTC+0700')
const leaveDate = new Date('2023-05-06')
let timer
function countdown() {
const currentDate = Date.now()
// difference of dates
const difference = leaveDate - currentDate
// if difference is negative than it's pass the target date
if (difference < 0) {
clearInterval(timer)
return
}
const _second = 1000
const _minute = _second * 60
const _hour = _minute * 60
const _day = _hour * 24
const _month = _day * 30
const _year = _month * 12
// calculate dates
let years = Math.floor(difference / _year)
let months = Math.floor((difference % _year) / _month)
let days = Math.floor((difference % _month) / _day)
let hours = Math.floor((difference % _day) / _hour)
let minutes = Math.floor((difference % _hour) / _minute)
let seconds = Math.floor((difference % _minute) / _second)
// fix dates so that it will show two digets
days = String(days).length >= 2 ? days : '0' + days
hours = String(hours).length >= 2 ? hours : '0' + hours
minutes = String(minutes).length >= 2 ? minutes : '0' + minutes
seconds = String(seconds).length >= 2 ? seconds : '0' + seconds
yearsEl.innerHTML = years
monthsEl.innerHTML = months
daysEl.innerHTML = days
hoursEl.innerHTML = hours
minutesEl.innerHTML = minutes
secondsEl.innerHTML = seconds
const beenPrimeMinisterForDays = Math.ceil(
(currentDate - coupDate) / 1000 / 60 / 60 / 24
)
upDaysEl.innerHTML = beenPrimeMinisterForDays
}
timer = setInterval(countdown, 1000)
</script>
</body>
</html>