-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
370 lines (324 loc) · 13.4 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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JKT48 Birthday Countdown</title>
<style>
/* Define CSS variables for theme colors */
:root {
--primary-color: #e91e63;
--secondary-color: #333;
--background-color: #f0f0f0;
--card-background: white;
--card-shadow: rgba(0, 0, 0, 0.1);
}
/* Basic body styling */
body {
font-family: 'Segoe UI', Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: var(--background-color);
transition: background-color 0.3s ease;
}
/* Container for centering content */
.container {
max-width: 800px;
margin: 0 auto;
}
/* Header styling */
.header {
text-align: center;
margin-bottom: 30px;
}
/* Controls styling for search and theme toggle */
.controls {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
gap: 10px;
flex-wrap: wrap;
}
/* Search box styling */
.search-box {
padding: 8px 15px;
border: 2px solid var(--primary-color);
border-radius: 20px;
font-size: 1em;
flex-grow: 1;
max-width: 300px;
}
/* Theme toggle button styling */
.theme-toggle {
background-color: var(--primary-color);
color: white;
border: none;
padding: 8px 20px;
border-radius: 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
/* Member card styling */
.member-card {
background-color: var(--card-background);
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 3px 10px var(--card-shadow);
transition: transform 0.2s ease, box-shadow 0.2s ease;
animation: fadeIn 0.5s ease;
}
/* Hover effect for member cards */
.member-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px var(--card-shadow);
}
/* Member name styling */
.member-name {
font-size: 1.5em;
font-weight: bold;
margin-bottom: 10px;
color: var(--primary-color);
}
/* Countdown text styling */
.countdown {
font-size: 1.2em;
color: var(--secondary-color);
margin-bottom: 10px;
}
/* Birthday date text styling */
.birthday-date {
color: #666;
font-size: 0.9em;
margin-top: 5px;
}
/* Special styling for today's birthday */
.birthday-today {
background: linear-gradient(45deg, #ff6b6b, #e91e63);
color: white;
}
/* Override text color for today's birthday */
.birthday-today .member-name,
.birthday-today .countdown,
.birthday-today .birthday-date {
color: white;
}
/* Fade-in animation */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Dark theme styling */
.dark-theme {
--background-color: #1a1a1a;
--card-background: #2d2d2d;
--secondary-color: #ffffff;
--card-shadow: rgba(0, 0, 0, 0.3);
}
/* Dark theme birthday date color */
.dark-theme .birthday-date {
color: #aaa;
}
/* Responsive styling for small screens */
@media (max-width: 600px) {
body {
padding: 10px;
}
.member-name {
font-size: 1.2em;
}
.countdown {
font-size: 1em;
}
.controls {
flex-direction: column;
}
.search-box {
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>JKT48 Birthday Countdown</h1>
</div>
<div class="controls">
<input type="text" class="search-box" placeholder="Cari member..." id="searchInput" aria-label="Search for member">
<button class="theme-toggle" id="themeToggle" aria-label="Toggle theme">Ganti Tema</button>
</div>
<div id="memberList"></div>
</div>
<script>
// List of members with their birthdays
const members = [
{"name": "Feni Fitryanti", "birthday": "16/01/1999"},
{"name": "Shania Gracia", "birthday": "31/08/1999"},
{"name": "Gita Sekar Andarini", "birthday": "30/06/2001"},
{"name": "Angelina Christy", "birthday": "05/12/2005"},
{"name": "Febriola Sinambela", "birthday": "26/02/2005"},
{"name": "Freya Jayawardana", "birthday": "13/02/2006"},
{"name": "Helisma Putri", "birthday": "15/06/2000"},
{"name": "Jessica Chandra", "birthday": "23/09/2005"},
{"name": "Mutiara Azzahra", "birthday": "12/07/2004"},
{"name": "Cornelia Vanisa", "birthday": "26/07/2002"},
{"name": "Fiony Alveria", "birthday": "04/02/2002"},
{"name": "Flora Shafiq", "birthday": "04/04/2005"},
{"name": "Lulu Salsabila", "birthday": "23/10/2002"},
{"name": "Indah Cahya", "birthday": "20/03/2001"},
{"name": "Kathrina Irene", "birthday": "26/07/2006"},
{"name": "Marsha Lenathea", "birthday": "09/01/2006"},
{"name": "Amanda Sukma", "birthday": "17/12/2004"},
{"name": "Aurellia", "birthday": "29/10/2002"},
{"name": "Callista Alifia", "birthday": "08/08/2005"},
{"name": "Gabriela Abigail", "birthday": "07/08/2006"},
{"name": "Indira Seruni", "birthday": "26/04/2004"},
{"name": "Jesslyn Elly", "birthday": "13/09/2001"},
{"name": "Raisha Syifa", "birthday": "11/11/2007"},
{"name": "Alya Amanda", "birthday": "26/08/2006"},
{"name": "Anindya Ramadhani", "birthday": "18/10/2005"},
{"name": "Cathleen Nixie", "birthday": "28/05/2009"},
{"name": "Celline Thefani", "birthday": "09/04/2007"},
{"name": "Chelsea Davina", "birthday": "23/12/2009"},
{"name": "Chynthia Yaputera", "birthday": "22/11/2003"},
{"name": "Dena Natalia", "birthday": "16/12/2005"},
{"name": "Desy Natalia", "birthday": "16/12/2005"},
{"name": "Gendis Mayrannisa", "birthday": "23/06/2010"},
{"name": "Grace Octaviani", "birthday": "18/10/2007"},
{"name": "Greesella Adhalia", "birthday": "10/01/2006"},
{"name": "Michelle Alexandra", "birthday": "22/04/2009"},
{"name": "Abigail Rachel", "birthday": "06/08/2008"},
{"name": "Adeline Wijaya", "birthday": "01/09/2007"},
{"name": "Aurhel Alana", "birthday": "14/09/2006"},
{"name": "Catherina Vallencia", "birthday": "21/08/2007"},
{"name": "Fritzy Rosmerian", "birthday": "28/07/2008"},
{"name": "Hillary Abigail", "birthday": "19/10/2007"},
{"name": "Jazzlyn Trisha", "birthday": "16/02/2011"},
{"name": "Letycia Moreen", "birthday": "07/06/2010"},
{"name": "Michelle Levia", "birthday": "24/01/2009"},
{"name": "Nayla Suji", "birthday": "18/06/2007"},
{"name": "Nina Tutachia", "birthday": "16/10/2009"},
{"name": "Oline Manuel", "birthday": "03/11/2007"},
{"name": "Ribka Budiman", "birthday": "13/01/2009"},
{"name": "Regina Wilian", "birthday": "10/12/2009"},
{"name": "Shabilqis Naila", "birthday": "01/09/2008"},
{"name": "Victoria Kimberly", "birthday": "08/03/2010"},
{"name": "Astrella Virgiananda", "birthday": "06/08/2010"},
{"name": "Aulia Riza", "birthday": "14/07/2007"},
{"name": "Bong Aprilli", "birthday": "01/04/2010"},
{"name": "Hagia Sopia", "birthday": "01/07/2008"},
{"name": "Humaira Ramadhani", "birthday": "13/08/2011"},
{"name": "Jacqueline Immanuela", "birthday": "09/07/2009"},
{"name": "Jemima Evodie", "birthday": "09/11/2009"},
{"name": "Mikaela Kusjanto", "birthday": "15/12/2007"},
{"name": "Nur Intan", "birthday": "24/02/2006"}
];
// Function to calculate the countdown to a birthday
function calculateCountdown(birthday) {
const [day, month, year] = birthday.split('/');
const now = new Date();
const thisYear = now.getFullYear();
let birthdayThisYear = new Date(thisYear, month - 1, day);
// If the birthday has already passed this year, calculate for next year
if (birthdayThisYear < now) {
birthdayThisYear = new Date(thisYear + 1, month - 1, day);
}
const diffTime = birthdayThisYear - now;
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// Calculate months, weeks, and days remaining
const months = Math.floor(diffDays / 30);
const remainingDays = diffDays % 30;
const weeks = Math.floor(remainingDays / 7);
const days = remainingDays % 7;
// Calculate age on the upcoming birthday
const age = thisYear - year + (birthdayThisYear.getFullYear() > thisYear ? 0 : 1);
return {
months: months,
weeks: weeks,
days: days,
totalDays: diffDays,
isToday: diffDays === 0,
age: age
};
}
// Function to format the countdown text
function formatCountdown(countdown) {
if (countdown.isToday) {
return "🎉 HAPPY BIRTHDAY! 🎉";
}
let result = [];
if (countdown.months > 0) {
result.push(`${countdown.months} bulan`);
}
if (countdown.weeks > 0) {
result.push(`${countdown.weeks} minggu`);
}
if (countdown.days > 0) {
result.push(`${countdown.days} hari`);
}
return result.join(', ') + ' lagi';
}
// Function to format the birthday date
function formatDate(dateStr) {
const [day, month, year] = dateStr.split('/');
const months = [
"Januari", "Februari", "Maret", "April", "Mei", "Juni",
"Juli", "Agustus", "September", "Oktober", "November", "Desember"
];
return `${day} ${months[parseInt(month) - 1]} ${year}`;
}
// Function to display members based on search term
function displayMembers(searchTerm = '') {
const memberList = document.getElementById('memberList');
const filteredMembers = members.filter(member =>
member.name.toLowerCase().includes(searchTerm.toLowerCase())
);
// Sort members by the countdown to their birthday
const sortedMembers = [...filteredMembers].sort((a, b) => {
const countdownA = calculateCountdown(a.birthday).totalDays;
const countdownB = calculateCountdown(b.birthday).totalDays;
return countdownA - countdownB;
});
// Render member cards
memberList.innerHTML = sortedMembers.map(member => {
const countdown = calculateCountdown(member.birthday);
const isBirthdayToday = countdown.isToday;
return `
<div class="member-card ${isBirthdayToday ? 'birthday-today' : ''}">
<div class="member-name">${member.name}</div>
<div class="countdown">${formatCountdown(countdown)}</div>
<div class="birthday-date">Tanggal Lahir: ${formatDate(member.birthday)}</div>
<div class="birthday-date">Usia saat ini: ${countdown.age} tahun</div>
</div>
`;
}).join('');
}
// Theme toggling logic
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', () => {
document.body.classList.toggle('dark-theme');
localStorage.setItem('theme', document.body.classList.contains('dark-theme') ? 'dark' : 'light');
});
// Search input event listener
const searchInput = document.getElementById('searchInput');
searchInput.addEventListener('input', (e) => {
displayMembers(e.target.value);
});
// Load saved theme from local storage
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.add('dark-theme');
}
// Initial display of members
displayMembers();
// Update the display every minute
setInterval(() => displayMembers(searchInput.value), 1000 * 60);
</script>
</body>
</html>