-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
323 lines (257 loc) · 11.3 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!-- 10/05/2024 -->
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Primary Meta Tags -->
<title>Hieunotes | Lịch Cúp Điện</title>
<meta name="title" content="Hieunotes | Lịch Cúp Điện" />
<meta name="description" content="Cập nhật lịch tạm ngừng cung cấp điện Điện lực Tây Ninh mới nhất." />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="//hieunotes.pages.dev/lcd/" />
<meta property="og:title" content="Hieunotes | Lịch Cúp Điện" />
<meta property="og:description" content="Cập nhật lịch tạm ngừng cung cấp điện Điện lực Tây Ninh mới nhất." />
<meta property="og:image" content="//s6.imgcdn.dev/W5WJC.png" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="//hieunotes.pages.dev/lcd/" />
<meta property="twitter:title" content="Hieunotes | Lịch Cúp Điện" />
<meta property="twitter:description" content="Cập nhật lịch tạm ngừng cung cấp điện Điện lực Tây Ninh mới nhất." />
<meta property="twitter:image" content="//s6.imgcdn.dev/W5WJC.png" />
<!-- Favicon -->
<link href="favicon.ico" rel="icon" type="image/x-icon">
<!-- Meta Tags Generated with //metatags.io -->
<!-- Font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<!-- CSS Bootstrap -->
<link href="bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
* {
font-family: "Be Vietnam Pro", sans-serif;
}
body, html {
height: 100%; /* Chiều cao đầy đủ cho body và html */
margin: 0; /* Xóa margin mặc định */
}
/*search-result {
margin: 20px;
}
*/
.result-tbl {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
color:#121212;
padding: 10px;
border: 1px solid #121212;
}
th {
color:#fff;
font-size: 0.8rem;
background-color: #0a1bb3;
}
tbody tr:nth-child(even) {
background-color: rgba(255, 255, 255, 0.1);
}
.form-control:focus {
border-color: #28a745;
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}
.notification {
background-color: #0a1bb3;
color: #fff;
padding: 10px;
border: 1px solid #f5c6cb;
border-radius: 5px;
}
.notification .ttl {
font-weight: bold;
margin-bottom: 5px;
}
.notification .red {
color: #fff;
}
.notification .time {
font-size: 0.9em;
}
.colorfull {
animation: Color 4s linear infinite;
-webkit-animation: Color 4s ease-in-out infinite;
text-shadow: 1px 2px #F0F0F0;
}
@keyframes Color {
0% { color: #A0D468; }
20% { color: #4FC1E9; }
40% { color: #FFCE54; }
60% { color: #FC6E51; }
80% { color: #ED5565; }
100% { color: #AC92EC; }
}
</style>
</head>
<body>
<!--- LOGO --->
<header class="p-3 fs-5 bg-light shadow-sm">
<span class="d-inline">
<b style="color: #0a1bb3;">
<a href="/" class="text-decoration-none" style="color: #0a1bb3;">Hieunotes</a>
</b>
<span class="text-secondary">Lịch Cúp Điện Tây Ninh</span>
</span>
</header>
<div class="container-lg">
<section class="pt-5 text-center">
<b>CHỌN KHU VỰC CỦA BẠN</b>
<div class="pt-1 d-flex d-flex justify-content-center">
<select class="form-select form-select-md border-primary" style="width: auto" id="select">
<option value='01' selected>TP. Tây Ninh</option>
<option value='02'>Gò Dầu</option>
<option value='03'>Trảng Bàng</option>
<option value='04'>Tân Châu</option>
<option value='05'>Châu Thành</option>
<option value='06'>Dương Minh Châu</option>
<option value='07'>Tân Biên</option>
<option value='08'>Hòa Thành</option>
<option value='09'>Bến Cầu</option>
</select>
</div>
</section>
</div>
<div class="container-xl">
<!-- DIV của tạo ảnh-->
<div id="elementToCapture">
<!-- DIV của tạo ảnh-->
<!-- KHU VỰC TABLE LỊCH CÚP ĐIỆN -->
<section class="mt-3">
<div class="p-3">Điện lực: <b id="khuvuc" class="text-success"></b></div>
<div id="ketqua"></div>
<p class="pt-4 text-center text-danger">Gọi ngay tổng đài hỗ trợ điện lực tại số<br><b>1900 1006</b> hoặc <b>1900 9000</b></p>
<div class="d-flex justify-content-center">
<button class="btn btn-light btn-sm fw-bold border" id="captureButton">TÂY NINH KÝ SỰ (tayninhkysu.com)
</button>
</div>
</section>
<!-- DIV của tạo ảnh-->
</div>
<!-- DIV của tạo ảnh -->
</div>
<div class="container mt-5">
<div class="card">
<div class="card-body">
<h3 class="card-title">Thời tiết hiện tại - <span id="location"></span></h3>
<p>Ngày: <span id="currentDate"></span></p>
<p>Nhiệt độ: <span id="temperature"></span>°C</p>
<p>Cảm giác như: <span id="feelsLike"></span>°C</p>
<p>Độ ẩm: <span id="humidity"></span></p>
<p>Tình trạng: <span id="status"></span></p>
<p>Tầm nhìn: <span id="visibility"></span></p>
<p>Tốc độ gió: <span id="wind"></span></p>
<p>Chỉ số UV: <span id="UV"></span></p>
<p>Bình minh: <span id="sunrise"></span>, Hoàng hôn: <span id="sunset"></span></p>
</div>
</div>
</div>
<hr/>
<footer class="text-center mt-2">
<p>
2024 - <strong class="colorfull">Harry Dang</strong><br/>
Lượt truy vấn: <strong id="requestCount">000</strong></p>
</footer>
<img src="https://s6.imgcdn.dev/HLZmv.jpg" class="img-fluid mx-auto d-block" style="width:20rem " alt="Hieunotes Lịch Cúp Điện Tây Ninh">
<script async="async" defer="defer" src="html2canvas.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Đặt giá trị mặc định cho select
document.getElementById('select').value = '01';
loadData();
// Xử lý sự kiện thay đổi giá trị của select
document.getElementById('select').addEventListener('change', function() {
setTimeout(function() {
loadData();
}, 1000); // Delay 1 giây trước khi gọi loadData
});
function loadData() {
const selectElement = document.getElementById('select');
const selectedText = selectElement.options[selectElement.selectedIndex].text;
const selectedValue = selectElement.value;
const url = '//lichcupdien.hns.workers.dev/?mdv=' + selectedValue;
// Hiển thị thông báo đang tải dữ liệu
document.getElementById('khuvuc').innerHTML = 'Đang tải dữ liệu. Vui lòng đợi...';
// Thêm delay trước khi thực hiện yêu cầu API
setTimeout(function() {
fetch(url)
.then(response => response.text())
.then(data => {
// Kiểm tra nếu dữ liệu có kết quả hoàn chỉnh
if (data && data.trim() !== "") {
document.getElementById('khuvuc').textContent = selectedText;
document.getElementById('ketqua').innerHTML = data; // In ra kết quả nếu dữ liệu không rỗng
} else {
document.getElementById('ketqua').innerHTML = '<p>Không có dữ liệu khả dụng.</p>';
}
})
.catch(() => {
document.getElementById('khuvuc').textContent = 'Không thể tải dữ liệu.';
});
}, 1500); // Thêm delay 1.5 giây trước khi thực hiện yêu cầu API
}
});
document.getElementById('captureButton').addEventListener('click', function() {
html2canvas(document.getElementById('elementToCapture'), {
scale:2}).then(function(canvas) {
var randomNumber = Math.floor(Math.random() * 100000);
var randomFileName = randomNumber + '_.png';
var link = document.createElement('a');
link.href = canvas.toDataURL();
link.download = randomFileName;
link.click();
});
});
// Gọi API để lấy số lượng request
fetch('https://count.hns.workers.dev/')
.then(response => response.json())
.then(data => {
// Hiển thị số lượng request vào phần tử có id là 'requestCount'
document.getElementById('requestCount').textContent = data.request_count;
})
.catch(error => {
console.error('Error:', error);
});
</script>
<script>
const url = 'https://weather-tayninh.hns.workers.dev/';
fetch(url)
.then(response => response.json()) // Chuyển đổi phản hồi thành đối tượng JSON
.then(data => {
const weatherData = data.Data; // Sửa lỗi cú pháp: `const` thay vì `cost`
// Display current weather
document.getElementById("location").innerText = weatherData.data.datainfo.location;
document.getElementById("currentDate").innerText = weatherData.data.datainfo.currentDate;
document.getElementById("temperature").innerText = weatherData.data.datainfo.temperature;
document.getElementById("feelsLike").innerText = weatherData.data.datainfo.feels_like;
document.getElementById("humidity").innerText = weatherData.data.datainfo.humidity;
document.getElementById("status").innerText = weatherData.data.datainfo.status;
document.getElementById("visibility").innerText = `${weatherData.data.datainfo.visibility.index} ${weatherData.data.datainfo.visibility.unit}`;
document.getElementById("wind").innerText = `${weatherData.data.datainfo.wind.index} ${weatherData.data.datainfo.wind.unit}`;
document.getElementById("UV").innerText = `${weatherData.data.datainfo.UV_index.index} (${weatherData.data.datainfo.UV_index.status})`;
document.getElementById("sunrise").innerText = weatherData.data.datainfo.sunrise;
document.getElementById("sunset").innerText = weatherData.data.datainfo.sunset;
// Display forecast
const forecastContainer = document.getElementById("forecast");
const forecastData = weatherData.data.datainfo.forecast;
})
.catch(error => {
console.error('Có lỗi xảy ra:', error);
});
</script>
<!-- Cloudflare Web Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "6dbbdf5abf554fb4bfb95964a7595858"}'></script><!-- End Cloudflare Web Analytics -->
</body>
</html>