Spaces:
Running
Running
Add 2 files
Browse files- README.md +6 -4
- index.html +482 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ali
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,482 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Interactive Calendar</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--primary-color: #4a6bff;
|
| 11 |
+
--secondary-color: #f5f8ff;
|
| 12 |
+
--text-color: #333;
|
| 13 |
+
--light-text: #777;
|
| 14 |
+
--today-color: #ffeaea;
|
| 15 |
+
--selected-color: #e5edff;
|
| 16 |
+
--border-color: #e0e0e0;
|
| 17 |
+
--hover-color: #f0f5ff;
|
| 18 |
+
--weekend-color: #fff8f8;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
* {
|
| 22 |
+
margin: 0;
|
| 23 |
+
padding: 0;
|
| 24 |
+
box-sizing: border-box;
|
| 25 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
body {
|
| 29 |
+
background-color: #f9f9f9;
|
| 30 |
+
display: flex;
|
| 31 |
+
justify-content: center;
|
| 32 |
+
align-items: center;
|
| 33 |
+
min-height: 100vh;
|
| 34 |
+
padding: 20px;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.calendar-container {
|
| 38 |
+
background-color: white;
|
| 39 |
+
border-radius: 16px;
|
| 40 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
|
| 41 |
+
width: 100%;
|
| 42 |
+
max-width: 420px;
|
| 43 |
+
overflow: hidden;
|
| 44 |
+
transition: all 0.3s ease;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.calendar-header {
|
| 48 |
+
background-color: var(--primary-color);
|
| 49 |
+
color: white;
|
| 50 |
+
padding: 20px;
|
| 51 |
+
text-align: center;
|
| 52 |
+
position: relative;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.month-year {
|
| 56 |
+
font-size: 1.5rem;
|
| 57 |
+
font-weight: 600;
|
| 58 |
+
margin-bottom: 5px;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.nav-buttons {
|
| 62 |
+
position: absolute;
|
| 63 |
+
top: 50%;
|
| 64 |
+
transform: translateY(-50%);
|
| 65 |
+
width: 100%;
|
| 66 |
+
display: flex;
|
| 67 |
+
justify-content: space-between;
|
| 68 |
+
padding: 0 10px;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.nav-button {
|
| 72 |
+
background: rgba(255, 255, 255, 0.2);
|
| 73 |
+
border: none;
|
| 74 |
+
color: white;
|
| 75 |
+
width: 36px;
|
| 76 |
+
height: 36px;
|
| 77 |
+
border-radius: 50%;
|
| 78 |
+
display: flex;
|
| 79 |
+
align-items: center;
|
| 80 |
+
justify-content: center;
|
| 81 |
+
cursor: pointer;
|
| 82 |
+
transition: all 0.2s;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.nav-button:hover {
|
| 86 |
+
background: rgba(255, 255, 255, 0.3);
|
| 87 |
+
transform: scale(1.1);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.weekdays {
|
| 91 |
+
display: grid;
|
| 92 |
+
grid-template-columns: repeat(7, 1fr);
|
| 93 |
+
background-color: var(--secondary-color);
|
| 94 |
+
padding: 12px 0;
|
| 95 |
+
text-align: center;
|
| 96 |
+
font-weight: 500;
|
| 97 |
+
color: var(--primary-color);
|
| 98 |
+
font-size: 0.9rem;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.days-grid {
|
| 102 |
+
display: grid;
|
| 103 |
+
grid-template-columns: repeat(7, 1fr);
|
| 104 |
+
gap: 4px;
|
| 105 |
+
padding: 10px;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.day {
|
| 109 |
+
aspect-ratio: 1;
|
| 110 |
+
display: flex;
|
| 111 |
+
align-items: center;
|
| 112 |
+
justify-content: center;
|
| 113 |
+
border-radius: 8px;
|
| 114 |
+
cursor: pointer;
|
| 115 |
+
transition: all 0.2s;
|
| 116 |
+
position: relative;
|
| 117 |
+
font-weight: 500;
|
| 118 |
+
color: var(--text-color);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.day:hover:not(.empty) {
|
| 122 |
+
background-color: var(--hover-color);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.empty {
|
| 126 |
+
background: transparent;
|
| 127 |
+
cursor: default;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.weekend {
|
| 131 |
+
color: var(--primary-color);
|
| 132 |
+
background-color: var(--weekend-color);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.today {
|
| 136 |
+
background-color: var(--today-color);
|
| 137 |
+
color: #d14545;
|
| 138 |
+
font-weight: 600;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.selected {
|
| 142 |
+
background-color: var(--selected-color);
|
| 143 |
+
color: var(--primary-color);
|
| 144 |
+
font-weight: 600;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.event-marker {
|
| 148 |
+
position: absolute;
|
| 149 |
+
bottom: 6px;
|
| 150 |
+
width: 5px;
|
| 151 |
+
height: 5px;
|
| 152 |
+
background-color: var(--primary-color);
|
| 153 |
+
border-radius: 50%;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
.has-event::after {
|
| 157 |
+
content: '';
|
| 158 |
+
position: absolute;
|
| 159 |
+
bottom: 6px;
|
| 160 |
+
width: 5px;
|
| 161 |
+
height: 5px;
|
| 162 |
+
background-color: var(--primary-color);
|
| 163 |
+
border-radius: 50%;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
.event-popup {
|
| 167 |
+
position: absolute;
|
| 168 |
+
top: calc(100% + 5px);
|
| 169 |
+
left: 50%;
|
| 170 |
+
transform: translateX(-50%);
|
| 171 |
+
background-color: white;
|
| 172 |
+
border-radius: 8px;
|
| 173 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 174 |
+
padding: 12px;
|
| 175 |
+
width: 200px;
|
| 176 |
+
z-index: 10;
|
| 177 |
+
display: none;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.event-popup::before {
|
| 181 |
+
content: '';
|
| 182 |
+
position: absolute;
|
| 183 |
+
bottom: 100%;
|
| 184 |
+
left: 50%;
|
| 185 |
+
transform: translateX(-50%);
|
| 186 |
+
border-width: 6px;
|
| 187 |
+
border-style: solid;
|
| 188 |
+
border-color: transparent transparent white transparent;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
.event-popup h4 {
|
| 192 |
+
margin-bottom: 8px;
|
| 193 |
+
color: var(--primary-color);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.event-popup p {
|
| 197 |
+
font-size: 0.9rem;
|
| 198 |
+
color: var(--light-text);
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.show-popup .event-popup {
|
| 202 |
+
display: block;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
.controls {
|
| 206 |
+
display: flex;
|
| 207 |
+
justify-content: center;
|
| 208 |
+
padding: 15px;
|
| 209 |
+
border-top: 1px solid var(--border-color);
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.add-event {
|
| 213 |
+
background-color: var(--primary-color);
|
| 214 |
+
color: white;
|
| 215 |
+
border: none;
|
| 216 |
+
padding: 10px 20px;
|
| 217 |
+
border-radius: 8px;
|
| 218 |
+
cursor: pointer;
|
| 219 |
+
display: flex;
|
| 220 |
+
align-items: center;
|
| 221 |
+
gap: 8px;
|
| 222 |
+
transition: all 0.2s;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
.add-event:hover {
|
| 226 |
+
background-color: #3a5bef;
|
| 227 |
+
transform: translateY(-1px);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
@media (max-width: 500px) {
|
| 231 |
+
.calendar-container {
|
| 232 |
+
border-radius: 0;
|
| 233 |
+
max-width: 100%;
|
| 234 |
+
height: 100vh;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.days-grid {
|
| 238 |
+
gap: 2px;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.day {
|
| 242 |
+
border-radius: 0;
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
</style>
|
| 246 |
+
</head>
|
| 247 |
+
<body>
|
| 248 |
+
<div class="calendar-container">
|
| 249 |
+
<div class="calendar-header">
|
| 250 |
+
<div class="month-year" id="month-year-display">Month Year</div>
|
| 251 |
+
<div class="nav-buttons">
|
| 252 |
+
<button class="nav-button" id="prev-month">
|
| 253 |
+
<i class="fas fa-chevron-left"></i>
|
| 254 |
+
</button>
|
| 255 |
+
<button class="nav-button" id="next-month">
|
| 256 |
+
<i class="fas fa-chevron-right"></i>
|
| 257 |
+
</button>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
|
| 261 |
+
<div class="weekdays">
|
| 262 |
+
<div>Sun</div>
|
| 263 |
+
<div>Mon</div>
|
| 264 |
+
<div>Tue</div>
|
| 265 |
+
<div>Wed</div>
|
| 266 |
+
<div>Thu</div>
|
| 267 |
+
<div>Fri</div>
|
| 268 |
+
<div>Sat</div>
|
| 269 |
+
</div>
|
| 270 |
+
|
| 271 |
+
<div class="days-grid" id="days-grid"></div>
|
| 272 |
+
|
| 273 |
+
<div class="controls">
|
| 274 |
+
<button class="add-event" id="today-button">
|
| 275 |
+
<i class="fas fa-calendar-day"></i> Today
|
| 276 |
+
</button>
|
| 277 |
+
<button class="add-event" id="add-event-button">
|
| 278 |
+
<i class="fas fa-plus"></i> Add Event
|
| 279 |
+
</button>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<script>
|
| 284 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 285 |
+
// Current date
|
| 286 |
+
let currentDate = new Date();
|
| 287 |
+
let currentYear = currentDate.getFullYear();
|
| 288 |
+
let currentMonth = currentDate.getMonth();
|
| 289 |
+
// Selected date
|
| 290 |
+
let selectedDate = new Date(currentDate);
|
| 291 |
+
|
| 292 |
+
// Sample events data
|
| 293 |
+
const events = {
|
| 294 |
+
'2023-11-15': {
|
| 295 |
+
title: 'Team Meeting',
|
| 296 |
+
description: 'Weekly team sync at 10 AM'
|
| 297 |
+
},
|
| 298 |
+
'2023-11-20': {
|
| 299 |
+
title: 'Project Deadline',
|
| 300 |
+
description: 'Submit final project documents'
|
| 301 |
+
},
|
| 302 |
+
'2023-11-25': {
|
| 303 |
+
title: 'Birthday Party',
|
| 304 |
+
description: 'House warming party at 7 PM'
|
| 305 |
+
}
|
| 306 |
+
};
|
| 307 |
+
|
| 308 |
+
// Initialize calendar
|
| 309 |
+
function initCalendar() {
|
| 310 |
+
updateMonthYearDisplay();
|
| 311 |
+
renderCalendar();
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
// Update month and year display
|
| 315 |
+
function updateMonthYearDisplay() {
|
| 316 |
+
const monthNames = [
|
| 317 |
+
'January', 'February', 'March', 'April', 'May', 'June',
|
| 318 |
+
'July', 'August', 'September', 'October', 'November', 'December'
|
| 319 |
+
];
|
| 320 |
+
document.getElementById('month-year-display').textContent =
|
| 321 |
+
`${monthNames[currentMonth]} ${currentYear}`;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
// Render calendar days
|
| 325 |
+
function renderCalendar() {
|
| 326 |
+
const daysGrid = document.getElementById('days-grid');
|
| 327 |
+
daysGrid.innerHTML = '';
|
| 328 |
+
|
| 329 |
+
// Get first day of month and total days in month
|
| 330 |
+
const firstDay = new Date(currentYear, currentMonth, 1).getDay();
|
| 331 |
+
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
|
| 332 |
+
const daysInPrevMonth = new Date(currentYear, currentMonth, 0).getDate();
|
| 333 |
+
|
| 334 |
+
// Add empty cells for days from previous month
|
| 335 |
+
for (let i = 0; i < firstDay; i++) {
|
| 336 |
+
const dayElement = createDayElement(daysInPrevMonth - firstDay + i + 1);
|
| 337 |
+
dayElement.classList.add('empty');
|
| 338 |
+
daysGrid.appendChild(dayElement);
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// Add days for current month
|
| 342 |
+
for (let i = 1; i <= daysInMonth; i++) {
|
| 343 |
+
const dayElement = createDayElement(i);
|
| 344 |
+
|
| 345 |
+
// Check if weekend
|
| 346 |
+
const dayOfWeek = new Date(currentYear, currentMonth, i).getDay();
|
| 347 |
+
if (dayOfWeek === 0 || dayOfWeek === 6) {
|
| 348 |
+
dayElement.classList.add('weekend');
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
// Check if today
|
| 352 |
+
const today = new Date();
|
| 353 |
+
if (i === today.getDate() &&
|
| 354 |
+
currentMonth === today.getMonth() &&
|
| 355 |
+
currentYear === today.getFullYear()) {
|
| 356 |
+
dayElement.classList.add('today');
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
// Check if selected
|
| 360 |
+
if (i === selectedDate.getDate() &&
|
| 361 |
+
currentMonth === selectedDate.getMonth() &&
|
| 362 |
+
currentYear === selectedDate.getFullYear()) {
|
| 363 |
+
dayElement.classList.add('selected');
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
// Check for events
|
| 367 |
+
const dateKey = `${currentYear}-${String(currentMonth + 1).padStart(2, '0')}-${String(i).padStart(2, '0')}`;
|
| 368 |
+
if (events[dateKey]) {
|
| 369 |
+
dayElement.classList.add('has-event');
|
| 370 |
+
|
| 371 |
+
// Add event popup
|
| 372 |
+
const popup = document.createElement('div');
|
| 373 |
+
popup.className = 'event-popup';
|
| 374 |
+
popup.innerHTML = `
|
| 375 |
+
<h4>${events[dateKey].title}</h4>
|
| 376 |
+
<p>${events[dateKey].description}</p>
|
| 377 |
+
`;
|
| 378 |
+
dayElement.appendChild(popup);
|
| 379 |
+
|
| 380 |
+
// Add event listeners for popup
|
| 381 |
+
dayElement.addEventListener('mouseenter', () => {
|
| 382 |
+
dayElement.classList.add('show-popup');
|
| 383 |
+
});
|
| 384 |
+
|
| 385 |
+
dayElement.addEventListener('mouseleave', () => {
|
| 386 |
+
dayElement.classList.remove('show-popup');
|
| 387 |
+
});
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
daysGrid.appendChild(dayElement);
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
// Calculate how many empty cells we need to add at the end
|
| 394 |
+
const totalCells = firstDay + daysInMonth;
|
| 395 |
+
const remainingCells = 7 - (totalCells % 7);
|
| 396 |
+
if (remainingCells < 7) { // Only add if not already a complete row
|
| 397 |
+
for (let i = 1; i <= remainingCells; i++) {
|
| 398 |
+
const dayElement = createDayElement(i);
|
| 399 |
+
dayElement.classList.add('empty');
|
| 400 |
+
daysGrid.appendChild(dayElement);
|
| 401 |
+
}
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
// Create day element
|
| 406 |
+
function createDayElement(day) {
|
| 407 |
+
const dayElement = document.createElement('div');
|
| 408 |
+
dayElement.className = 'day';
|
| 409 |
+
dayElement.textContent = day;
|
| 410 |
+
|
| 411 |
+
dayElement.addEventListener('click', function() {
|
| 412 |
+
if (!this.classList.contains('empty')) {
|
| 413 |
+
// Remove selected class from all days
|
| 414 |
+
document.querySelectorAll('.day').forEach(day => {
|
| 415 |
+
day.classList.remove('selected');
|
| 416 |
+
});
|
| 417 |
+
|
| 418 |
+
// Add selected class to clicked day
|
| 419 |
+
this.classList.add('selected');
|
| 420 |
+
|
| 421 |
+
// Update selected date
|
| 422 |
+
selectedDate = new Date(currentYear, currentMonth, day);
|
| 423 |
+
}
|
| 424 |
+
});
|
| 425 |
+
|
| 426 |
+
return dayElement;
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
// Navigation buttons
|
| 430 |
+
document.getElementById('prev-month').addEventListener('click', function() {
|
| 431 |
+
currentMonth--;
|
| 432 |
+
if (currentMonth < 0) {
|
| 433 |
+
currentMonth = 11;
|
| 434 |
+
currentYear--;
|
| 435 |
+
}
|
| 436 |
+
updateMonthYearDisplay();
|
| 437 |
+
renderCalendar();
|
| 438 |
+
});
|
| 439 |
+
|
| 440 |
+
document.getElementById('next-month').addEventListener('click', function() {
|
| 441 |
+
currentMonth++;
|
| 442 |
+
if (currentMonth > 11) {
|
| 443 |
+
currentMonth = 0;
|
| 444 |
+
currentYear++;
|
| 445 |
+
}
|
| 446 |
+
updateMonthYearDisplay();
|
| 447 |
+
renderCalendar();
|
| 448 |
+
});
|
| 449 |
+
|
| 450 |
+
// Today button
|
| 451 |
+
document.getElementById('today-button').addEventListener('click', function() {
|
| 452 |
+
currentDate = new Date();
|
| 453 |
+
currentYear = currentDate.getFullYear();
|
| 454 |
+
currentMonth = currentDate.getMonth();
|
| 455 |
+
selectedDate = new Date(currentDate);
|
| 456 |
+
updateMonthYearDisplay();
|
| 457 |
+
renderCalendar();
|
| 458 |
+
});
|
| 459 |
+
|
| 460 |
+
// Add event button
|
| 461 |
+
document.getElementById('add-event-button').addEventListener('click', function() {
|
| 462 |
+
const eventTitle = prompt('Enter event title:');
|
| 463 |
+
if (eventTitle) {
|
| 464 |
+
const eventDesc = prompt('Enter event description:') || '';
|
| 465 |
+
const dateKey = `${currentYear}-${String(currentMonth + 1).padStart(2, '0')}-${String(selectedDate.getDate()).padStart(2, '0')}`;
|
| 466 |
+
|
| 467 |
+
events[dateKey] = {
|
| 468 |
+
title: eventTitle,
|
| 469 |
+
description: eventDesc
|
| 470 |
+
};
|
| 471 |
+
|
| 472 |
+
renderCalendar();
|
| 473 |
+
alert(`Event added to ${selectedDate.toLocaleDateString()}`);
|
| 474 |
+
}
|
| 475 |
+
});
|
| 476 |
+
|
| 477 |
+
// Initialize the calendar
|
| 478 |
+
initCalendar();
|
| 479 |
+
});
|
| 480 |
+
</script>
|
| 481 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
|
| 482 |
+
</html>
|