-
Notifications
You must be signed in to change notification settings - Fork 637
/
moreevents.html
453 lines (384 loc) · 13.8 KB
/
moreevents.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
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
446
447
448
449
450
451
452
453
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wildlife Conservation Events</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
:root {
--primary-color: #91BE55; /* Forest Green */
--background-color: #f0f8ff; /* Light blue (nature-like) */
--card-background: #ffffff;
--text-color: #91BE55; /* Sea Green */
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: var(--background-color);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
h1, h2 {
font-size: 2em;
margin-bottom: 10px;
}
.main-event {
background: url(./assets/images/hero.jpg);
object-fit: cover;
background-color: var(--card-background);
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
color: #f0f8ff;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.events-container {
padding: 20px 0;
}
.event-card {
display: flex;
align-items: center;
gap: 2px;
justify-content: space-between;
padding: 20px;
margin-bottom: 20px;
background-color: var(--card-background);
border-radius: 10px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
transition: transform 0.3s;
}
.event-card:hover {
border: 3px solid var(--primary-color);
}
/* Date Section */
.event-date {
display: flex;
flex-direction: column;
align-items: center;
background-color: var(--primary-color);
box-shadow: 0 2px 10px #5b7737;
color: white;
padding: 10px;
border-radius: 8px;
width: 80px;
}
.event-date .month {
font-size: 1.2em;
}
.event-date .day {
font-size: 2.5em;
font-weight: bold;
}
.event-details {
flex: 1;
margin-left: 20px;
}
.event-details h3 {
margin: 0;
font-size: 1.5em;
padding-bottom: 10px;
color: var(--primary-color);
}
.event-details p {
margin: 5px 0;
}
.event-action {
text-align: right;
}
button {
background-color: gray; /* Change button background color to black */
color: white; /* Keep text color white for contrast */
border: none;
padding: 8px 15px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
button:hover {
background-color: #444; /* Darker shade for hover effect */
}
/* Back Button Styling */
.back-btn {
background-color: var(--primary-color); /* Change back button background color to black */
color: white;
border: none;
padding: 10px 20px;
margin-bottom: 20px;
border-radius: 5px;
cursor: pointer;
font-size: 1em;
}
.back-btn:hover {
background-color: #444; /* Darker shade for hover effect */
}
@media (max-width: 768px) {
.event-card {
flex-direction: column;
align-items: flex-start;
}
.event-action {
margin-top: 15px;
text-align: left;
}
header {
flex-direction: column;
align-items: flex-start;
}
nav {
margin-top: 10px;
}
nav a {
margin: 5px 10px 5px 0;
}
}
</style>
</head>
<body>
<div class="container">
<!-- Back Button -->
<button class="back-btn" onclick="goBack()">← Back</button>
<main>
<div class="main-event">
<h1 id="mainEventName">Save the Forests</h1>
<p id="mainEventDate"></p>
<button onclick="remindMe()">Set Reminder</button>
</div>
<h2>Upcoming Conservation Events</h2>
<div id="futureEvents" class="events-container"></div>
<h2>Previous Wildlife Events</h2>
<div id="pastEvents" class="events-container"></div>
</main>
</div>
<!--calendar of events -->
<style>
/* Button Styling */
#calendar-btn {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
margin-top: 20px;
}
/* Modal Styling */
.modal {
display: none; /* Hidden by default */
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.modal-content {
position: relative;
text-align: center;
}
#close-btn {
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
font-size: 20px;
}
/* Calendar Styling */
#event-calendar {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 10px;
margin-top: 20px;
}
.day {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
text-align: center;
background-color: white;
}
.event-day {
background-color: #4CAF50;
color: white;
font-weight: bold;
}
</style>
</head>
<body>
<section id="event-section">
<button id="calendar-btn">Show Events Calendar 📅</button>
<!-- Calendar Modal -->
<div id="calendar-modal" class="modal">
<div class="modal-content">
<span id="close-btn">×</span>
<h2>Animal-Saving Events Calendar</h2>
<div id="event-calendar"></div>
</div>
</div>
</section>
<script>
document.addEventListener('DOMContentLoaded', () => {
const calendarBtn = document.getElementById('calendar-btn');
const calendarModal = document.getElementById('calendar-modal');
const closeBtn = document.getElementById('close-btn');
const events = [
{ date: "2024-10-25", name: "Wildlife Awareness Drive" },
{ date: "2024-11-05", name: "Animal Rescue Campaign" },
{ date: "2024-11-12", name: "Stray Animal Adoption Event" }
];
// Open Modal on Button Click
calendarBtn.addEventListener('click', () => {
calendarModal.style.display = 'block';
generateEventCalendar();
});
// Close Modal on Close Button Click
closeBtn.addEventListener('click', () => {
calendarModal.style.display = 'none';
});
// Generate Calendar for the Current Month
function generateEventCalendar() {
const calendar = document.getElementById('event-calendar');
calendar.innerHTML = ''; // Clear previous content
const today = new Date();
const year = today.getFullYear();
const month = today.getMonth();
const firstDay = new Date(year, month, 1).getDay();
const daysInMonth = new Date(year, month + 1, 0).getDate();
// Add empty cells before the 1st day
for (let i = 0; i < firstDay; i++) {
calendar.appendChild(document.createElement('div'));
}
// Add days with events
for (let day = 1; day <= daysInMonth; day++) {
const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
const dayElement = document.createElement('div');
dayElement.classList.add('day');
dayElement.textContent = day;
// Highlight if this day has an event
const event = events.find(e => e.date === dateStr);
if (event) {
dayElement.classList.add('event-day');
dayElement.textContent += ` - ${event.name}`;
}
calendar.appendChild(dayElement);
}
}
});
</script>
<script>
const events = [
{
name: "Forest Restoration Drive",
date: '2024-10-22',
time: '9:00 AM',
type: 'main',
location: 'Central Park, New York',
description: 'Join us for a day of planting trees and restoring the natural habitat.'
},
{
name: "Clean Our Oceans",
date: '2024-10-23',
time: '10:00 AM',
type: 'future',
location: 'Santa Monica Beach, California',
description: 'Help us clean up our oceans and beaches to protect marine life.'
},
{
name: "Plant a Tree Campaign",
date: '2024-10-24',
time: '11:00 AM',
type: 'future',
location: 'Golden Gate Park, San Francisco',
description: 'Participate in our campaign to plant trees and enhance urban greenery.'
},
{
name: "Save the Wetlands",
date: '2024-10-25',
time: '8:00 AM',
type: 'future',
location: 'Everglades, Florida',
description: 'Join us in preserving wetlands and protecting wildlife habitats.'
},
{
name: "Wildlife Rescue Operations",
date: '2024-10-21',
time: '7:00 AM',
type: 'past',
location: 'City Zoo, Chicago',
description: 'Volunteer with us to rescue and rehabilitate wildlife.'
}
];
async function displayEvents() {
const mainEvent = events.find(event => event.type === 'main');
if (mainEvent) {
document.getElementById('mainEventName').textContent = mainEvent.name;
document.getElementById('mainEventDate').textContent = `${formatDate(mainEvent.date)} at ${mainEvent.time}`;
}
const futureEvents = document.getElementById('futureEvents');
const pastEvents = document.getElementById('pastEvents');
for (const event of events) {
if (event.type === 'main') continue;
const eventElement = document.createElement('div');
eventElement.className = 'event-card';
eventElement.innerHTML = `
<div class="event-date">
<span class="month">${new Date(event.date).toLocaleString('default', { month: 'short' })}</span>
<span class="day">${new Date(event.date).getDate()}</span>
</div>
<div class="event-details">
<h3>${event.name}</h3>
<p>${event.description}</p>
<p><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo-alt-fill" viewBox="0 0 16 16">
<path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/>
</svg>${event.location}</p>
<p>${formatDate(event.date)} at ${event.time}</p>
</div>
<div class="event-action">
<button onclick="getTickets('${event.name}')">
Get Involved
</button>
</div>
`;
if (event.type === 'future') {
futureEvents.appendChild(eventElement);
} else if (event.type === 'past') {
pastEvents.appendChild(eventElement);
}
}
}
function formatDate(dateString) {
const date = new Date(dateString);
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
return date.toLocaleDateString('en-US', options);
}
function remindMe() {
alert('Reminder set for the upcoming conservation event!');
}
function getTickets(eventName) {
if (eventName === "Clean Our Oceans") {
window.location.href = "cleanocean.html";
} else if (eventName === "Plant a Tree Campaign") {
window.location.href = "treeCampaign.html";
} else {
alert('Redirecting to event registration...');
}
}
function viewDetails() {
alert('Viewing event details...');
}
// Function to go back to the previous page
function goBack() {
window.history.back();
}
displayEvents();
</script>
</body>
<!-- rebooted -->
</html>