-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
445 lines (409 loc) · 18.4 KB
/
index.html
File metadata and controls
445 lines (409 loc) · 18.4 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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Calendar</title>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Arial, sans-serif;
min-height: 100vh;
min-width: 100vw;
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
background: #181824;
color: #e0e0e0;
}
.calendar {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
max-width: none;
max-height: none;
margin: 0;
border: none;
padding: 0;
border-radius: 0;
background: #232336;
box-shadow: 0 4px 32px #0008;
}
.calendar-header {
text-align: center;
font-weight: 600;
margin-bottom: 0;
font-size: 2.2vw;
letter-spacing: 1px;
padding: 2vw 0 1vw 0;
color: #fff;
background: linear-gradient(90deg, #2d2d44 0%, #232336 100%);
border-bottom: 1px solid #28284a;
box-shadow: 0 2px 8px #0004;
}
.calendar-nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5vw 2vw;
background: #232336;
color: #b3e0ff;
font-size: 1.3vw;
font-weight: 600;
border-bottom: 1px solid #28284a;
}
.calendar-nav button {
background: #232346;
color: #b3e0ff;
border: none;
border-radius: 6px;
padding: 0.4em 1.2em;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: background 0.2s, color 0.2s;
}
.calendar-nav button:hover {
background: #38bdf8;
color: #181824;
}
.calendar-table {
display: flex;
flex-direction: column;
width: 100%;
flex: 1 1 0;
height: 100%;
justify-content: stretch;
}
.calendar-row {
display: flex;
width: 100%;
flex: 1 1 0;
}
.calendar-table th,
.calendar-table td {
flex: 1 1 0;
height: 100%;
text-align: center;
border: 1px solid #232336;
position: relative;
padding: 0;
background: none;
min-width: 0;
min-height: 0;
font-size: 1.5vw;
transition: background 0.2s;
}
.calendar-table .header span {
background: #232336;
height: 7vh;
font-size: 1.3vw;
color: #b3e0ff;
letter-spacing: 1px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
border-bottom: 1px solid #28284a;
}
.calendar-table .header span {
margin-top: auto;
flex: 1 1 0;
}
.calendar-table td {
background: none;
}
.calendar-day-content {
position: relative;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
width: 4vw;
height: 4vw;
min-width: 28px;
min-height: 28px;
max-width: 80px;
max-height: 80px;
margin: auto;
border-radius: 50%;
font-size: 1.2vw;
font-weight: 500;
background: none;
transition: box-shadow 0.2s, background 0.2s;
color: #e0e0e0;
}
.calendar-table td:not(:empty):hover .calendar-day-content {
box-shadow: 0 0 0 4px #b3e0ff60;
background: #232346;
cursor: pointer;
}
.highlight-purple {
background: #7c3aed;
color: #fff;
position: relative;
overflow: hidden;
}
.highlight-blue {
background: #38bdf8;
color: #181824;
position: relative;
overflow: hidden;
}
.highlight-green {
background: #15803d;
color: #fff;
position: relative;
overflow: hidden;
}
.highlight-both {
background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
color: #fff;
position: relative;
overflow: visible;
}
.calendar-day-content .icon {
position: absolute;
width: 1.3vw;
height: 1.3vw;
min-width: 16px;
min-height: 16px;
max-width: 26px;
max-height: 26px;
opacity: 0.92;
z-index: 3;
pointer-events: none;
transition: filter 0.2s;
left: 50%;
top: 22%;
transform: translate(-50%, 0);
}
.calendar-day-content .icon.dumbbell.both-right {
top: 20%;
transform: translate(-120%, 0);
}
.calendar-day-content .icon.waves.both-left {
top: 20%;
transform: translate(40%, 0);
}
.calendar-day-content .icon.rest {
color: #fff;
fill: #fff;
left: 45%;
top: 20%;
width: 1.3vw;
height: 1.3vw;
min-width: 16px;
min-height: 16px;
max-width: 26px;
max-height: 26px;
opacity: 0.92;
z-index: 3;
pointer-events: none;
position: absolute;
transform: translate(-50%, 0);
}
.calendar-day-content span.day-number {
position: absolute;
left: 50%;
bottom: 5%;
transform: translate(-50%, 0);
z-index: 4;
font-size: 1.1em;
font-weight: 600;
letter-spacing: 0.5px;
}
.calendar-table .calendar-row.header th {
font-weight: 700;
}
.calendar-day-content[style*="opacity:0.35"] {
color: #7a7a9a !important;
}
.calendar-day-content.today {
box-shadow: 0 0 0 4px #fff, 0 0 16px 2px #38bdf8cc;
border: 2px solid #fff;
background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
color: #fff !important;
}
.calendar-day-content.muted {
filter: grayscale(0.5) brightness(0.8) opacity(0.7);
}
.calendar-day-content.no-activity {
filter: grayscale(1) brightness(1.5) opacity(0.25) !important;
}
@media (max-width: 600px) {
.calendar-header {
font-size: 1.1em;
}
.calendar-day-content {
width: 28px;
height: 28px;
font-size: 0.95em;
}
.calendar-table th,
.calendar-table td {
height: 32px;
font-size: 0.9em;
}
}
</style>
</head>
<body>
<div class="calendar-nav">
<button id="prevMonth">← Prev</button>
<span id="calendarMonthLabel"></span>
<button id="nextMonth">Next →</button>
</div>
<div class="calendar" id="calendar"></div>
<script>
// Only one SVG definition, to be replaced as needed
const SVG_ICONS = {
dumbbell: `<svg class='icon dumbbell' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 64c0-17.7 14.3-32 32-32l32 0c17.7 0 32 14.3 32 32l0 160 0 64 0 160c0 17.7-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32l0-64-32 0c-17.7 0-32-14.3-32-32l0-64c-17.7 0-32-14.3-32-32s14.3-32 32-32l0-64c0-17.7 14.3-32 32-32l32 0 0-64zm448 0l0 64 32 0c17.7 0 32 14.3 32 32l0 64c17.7 0 32 14.3 32 32s-14.3 32-32 32l0 64c0 17.7-14.3 32-32 32l-32 0 0 64c0 17.7-14.3 32-32 32l-32 0c-17.7 0-32-14.3-32-32l0-160 0-64 0-160c0-17.7 14.3-32 32-32l32 0c17.7 0 32 14.3 32 32zM416 224l0 64-192 0 0-64 192 0z"/></svg>`,
waves: `<svg class='icon waves' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M309.5 178.4L447.9 297.1c-1.6 .9-3.2 2-4.8 3c-18 12.4-40.1 20.3-59.2 20.3c-19.6 0-40.8-7.7-59.2-20.3c-22.1-15.5-51.6-15.5-73.7 0c-17.1 11.8-38 20.3-59.2 20.3c-10.1 0-21.1-2.2-31.9-6.2C163.1 193.2 262.2 96 384 96l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-26.9 0-52.3 6.6-74.5 18.4zM160 160A64 64 0 1 1 32 160a64 64 0 1 1 128 0zM306.5 325.9C329 341.4 356.5 352 384 352c26.9 0 55.4-10.8 77.4-26.1c0 0 0 0 0 0c11.9-8.5 28.1-7.8 39.2 1.7c14.4 11.9 32.5 21 50.6 25.2c17.2 4 27.9 21.2 23.9 38.4s-21.2 27.9-38.4 23.9c-24.5-5.7-44.9-16.5-58.2-25C449.5 405.7 417 416 384 416c-31.9 0-60.6-9.9-80.4-18.9c-5.8-2.7-11.1-5.3-15.6-7.7c-4.5 2.4-9.7 5.1-15.6 7.7c-19.8 9-48.5 18.9-80.4 18.9c-33 0-65.5-10.3-94.5-25.8c-13.4 8.4-33.7 19.3-58.2 25c-17.2 4-34.4-6.7-38.4-23.9s6.7-34.4 23.9-38.4c18.1-4.2 36.2-13.3 50.6-25.2c11.1-9.4 27.3-10.1 39.2-1.7c0 0 0 0 0 0C136.7 341.2 165.1 352 192 352c27.5 0 55-10.6 77.5-26.1c11.1-7.9 25.9-7.9 37 0z"/></svg>`,
rest: `<svg class='icon rest' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M279.1 512c-74.99 0-143.36-41.13-178.56-107.38-5.41-10.09 3.13-22.09 14.47-20.62 1.13.15 2.28.23 3.43.23 97.05 0 175.52-78.47 175.52-175.52 0-44.13-16.13-86.13-45.44-118.7-7.41-8.19-2.44-21.13 8.59-22.41C262.1 66.13 271.1 64 280.1 64c88.22 0 159.87 71.65 159.87 159.87 0 158.87-128.99 288.13-288.13 288.13z"/></svg>`
};
let currentYear = (new Date()).getFullYear();
let currentMonth = (new Date()).getMonth();
function getNoActivityKey(year, month) {
return `noActivityDays-${year}-${month}`;
}
function saveNoActivityDays(year, month, days) {
localStorage.setItem(getNoActivityKey(year, month), JSON.stringify(days));
}
function loadNoActivityDays(year, month) {
const data = localStorage.getItem(getNoActivityKey(year, month));
return data ? JSON.parse(data) : [];
}
function renderCalendar(year = currentYear, month = currentMonth) {
currentYear = year;
currentMonth = month;
const now = new Date();
const todayDate = (year === now.getFullYear() && month === now.getMonth()) ? now.getDate() : null;
const firstDay = new Date(year, month, 1);
const lastDay = new Date(year, month + 1, 0);
const startDay = firstDay.getDay();
const daysInMonth = lastDay.getDate();
const prevMonthLastDay = new Date(year, month, 0).getDate();
const monthNames = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
// 0=Sun, 1=Mon, ..., 6=Sat
const purpleDays = [1, 4, 6]; // Mon, Thu, Sat
const blueDays = [0, 3, 4, 5, 6]; // Sun, Wed, Thu, Fri, Sat
const greenDay = 2; // Tuesday
// Only apply custom coloring for the current month (June 2025)
const isFirstMonth = (year === 2025 && month === 5); // June is month 5 (0-based)
const swimmingOnlyDays = isFirstMonth ? [2, 3, 5, 7, 9, 10, 11, 12, 14] : [];
const bothDays = isFirstMonth ? [17] : [];
document.getElementById('calendarMonthLabel').textContent = `${monthNames[month]} ${year}`;
let html = `<div class=\"calendar-header\">${monthNames[month]} ${year}</div>`;
html += '<div class=\"calendar-table\">';
// Header row spaced as days
html += '<div class=\"calendar-row header\">';
const weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
for (let d = 0; d < 7; d++) {
html += `<th><span style=\"width:100%;display:inline-block;text-align:center;\">${weekDays[d]}</span></th>`;
}
html += '</div>';
let day = 1;
let nextMonthDay = 1;
let started = false;
const noActivityDays = loadNoActivityDays(year, month);
for (let i = 0; i < 6; i++) {
html += '<div class="calendar-row">';
for (let j = 0; j < 7; j++) {
let cellHtml = '';
if (!started && j < startDay) {
// Previous month's days (optional: faded)
let prevDay = prevMonthLastDay - startDay + j + 1;
cellHtml = `<span class=\"calendar-day-content\" style=\"opacity:0.35;\">${prevDay}</span>`;
html += `<td>${cellHtml}</td>`;
} else if (day > daysInMonth) {
// Next month's days (optional: faded)
cellHtml = `<span class=\"calendar-day-content\" style=\"opacity:0.35;\">${nextMonthDay}</span>`;
html += `<td>${cellHtml}</td>`;
nextMonthDay++;
} else {
started = true;
let isPurple = purpleDays.includes(j);
let isBlue = blueDays.includes(j);
let isGreen = (j === greenDay);
let icons = '';
let todayClass = (day === todayDate) ? ' today' : '';
let mutedClass = (day !== todayDate && day !== todayDate - 1 && day !== todayDate + 1) ? ' muted' : '';
let noActivityClass = noActivityDays.includes(day) ? ' no-activity' : '';
if (bothDays.includes(day)) {
icons = SVG_ICONS.waves.replace('icon waves', 'icon waves both-left') + SVG_ICONS.dumbbell.replace('icon dumbbell', 'icon dumbbell both-right');
cellHtml = `<span class="calendar-day-content highlight-both${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else if (swimmingOnlyDays.includes(day)) {
icons = SVG_ICONS.waves;
cellHtml = `<span class="calendar-day-content highlight-blue${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else if (isPurple && isBlue) {
icons = SVG_ICONS.waves.replace('icon waves', 'icon waves both-left') + SVG_ICONS.dumbbell.replace('icon dumbbell', 'icon dumbbell both-right');
cellHtml = `<span class="calendar-day-content highlight-both${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else if (isPurple) {
icons = SVG_ICONS.dumbbell;
cellHtml = `<span class="calendar-day-content highlight-purple${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else if (isBlue) {
icons = SVG_ICONS.waves;
cellHtml = `<span class="calendar-day-content highlight-blue${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else if (isGreen) {
icons = SVG_ICONS.rest;
cellHtml = `<span class="calendar-day-content highlight-green${todayClass}${mutedClass}${noActivityClass}">${icons}<span class="day-number">${day}</span></span>`;
} else {
cellHtml = `<span class="calendar-day-content${todayClass}${mutedClass}${noActivityClass}"><span class="day-number">${day}</span></span>`;
}
html += `<td>${cellHtml}</td>`;
day++;
}
}
html += '</div>';
if (day > daysInMonth && nextMonthDay > 7) break;
}
html += '</div>';
document.getElementById('calendar').innerHTML = html.replace(/\\"/g, '"');
// Add click event listeners to day cells after rendering
document.querySelectorAll('.calendar-day-content').forEach(function(dayEl) {
dayEl.addEventListener('click', function(e) {
const dayNum = parseInt(dayEl.querySelector('.day-number').textContent);
let noActivityDays = loadNoActivityDays(currentYear, currentMonth);
if (dayEl.classList.contains('no-activity')) {
dayEl.classList.remove('no-activity');
noActivityDays = noActivityDays.filter(d => d !== dayNum);
} else {
dayEl.classList.add('no-activity');
if (!noActivityDays.includes(dayNum)) noActivityDays.push(dayNum);
}
saveNoActivityDays(currentYear, currentMonth, noActivityDays);
});
});
}
document.getElementById('prevMonth').onclick = function() {
let m = currentMonth - 1;
let y = currentYear;
if (m < 0) { m = 11; y--; }
renderCalendar(y, m);
};
document.getElementById('nextMonth').onclick = function() {
let m = currentMonth + 1;
let y = currentYear;
if (m > 11) { m = 0; y++; }
renderCalendar(y, m);
};
renderCalendar();
</script>
</body>
</html>