File size: 20,048 Bytes
c64d00c |
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 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
=== index.html ===
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elon Musk Charity Worldwide - AI-Powered Donation Assistant</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;700&family=Open+Sans:wght@300;400;600&display=swap" rel="stylesheet">
</head>
<body>
<header>
<nav>
<div class="nav-container">
<div class="logo">
<h1>Elon Musk Charity Worldwide</h1>
<span class="tagline">AI-Driven Humanitarian Aid</span>
</div>
<ul class="nav-links">
<li><a href="#mission">Mission</a></li>
<li><a href="#impact">Impact</a></li>
<li><a href="#donate">Donate</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<button class="mobile-menu-toggle" aria-label="Toggle menu">
<span></span>
<span></span>
<span></span>
</button>
</div>
</nav>
</header>
<main>
<section class="hero">
<div class="hero-content">
<h1>AI-Powered Charity for Yemen & Gaza</h1>
<p>Experience the future of giving with intelligent donation optimization</p>
<button class="cta-button" id="ai-donate-btn">Let AI Optimize My Donation</button>
</div>
<div class="hero-stats">
<div class="stat">
<span class="stat-number" id="total-donations">$0</span>
<span class="stat-label">Raised</span>
</div>
<div class="stat">
<span class="stat-number" id="lives-impacted">0</span>
<span class="stat-label">Lives Impacted</span>
</div>
</div>
</section>
<section class="ai-assistant">
<div class="container">
<h2>AI Donation Assistant</h2>
<div class="chat-container">
<div id="chat-messages"></div>
<div class="chat-input-container">
<input type="text" id="chat-input" placeholder="Ask our AI how to maximize your impact...">
<button id="send-button">Send</button>
</div>
</div>
</div>
</section>
<section class="mission">
<div class="container">
<h2>Our Mission</h2>
<div class="mission-grid">
<div class="mission-card">
<h3>Yemen Relief</h3>
<p>AI-optimized food and medical aid distribution</p>
<div class="progress-bar">
<div class="progress" style="width: 78%"></div>
</div>
<span>78% of goal reached</span>
</div>
<div class="mission-card">
<h3>Gaza Support</h3>
<p>Smart resource allocation for maximum impact</p>
<div class="progress-bar">
<div class="progress" style="width: 65%"></div>
</div>
<span>65% of goal reached</span>
</div>
</div>
</div>
</section>
<section class="donation-form">
<div class="container">
<h2>Make a Donation</h2>
<form id="donation-form">
<div class="form-group">
<label for="donation-amount">Donation Amount</label>
<input type="number" id="donation-amount" min="1" step="0.01" placeholder="Enter amount" required>
</div>
<div class="form-group">
<label for="donation-currency">Currency</label>
<select id="donation-currency">
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
</select>
</div>
<div class="form-group">
<label for="donation-cause">Designate Cause</label>
<select id="donation-cause">
<option value="auto">Let AI Decide</option>
<option value="yemen">Yemen Relief</option>
<option value="gaza">Gaza Support</option>
</select>
</div>
<button type="submit" class="submit-btn">Donate Now</button>
</form>
<div id="processing" class="hidden">
<div class="spinner"></div>
<p>Processing your donation with AI optimization...</p>
</div>
</div>
</section>
</main>
<footer>
<div class="container">
<p>© 2024 Elon Musk Charity Worldwide. Powered by AI for maximum impact.</p>
<div class="social-links">
<a href="#" aria-label="Twitter">Twitter</a>
<a href="#" aria-label="LinkedIn">LinkedIn</a>
<a href="#" aria-label="Instagram">Instagram</a>
</div>
</div>
</footer>
<script type="module" src="index.js"></script>
</body>
</html>
=== index.js ===
// index.js
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
env.allowLocalModels = false;
class AIDonationAssistant {
constructor() {
this.chatbot = null;
this.sentimentAnalyzer = null;
this.isInitialized = false;
this.chatHistory = [];
this.init();
}
async init() {
try {
// Initialize sentiment analyzer for donation optimization
this.sentimentAnalyzer = await pipeline(
'sentiment-analysis',
'Xenova/distilbert-base-uncased-finetuned-sst-2-english'
);
// Initialize conversational AI
this.chatbot = await pipeline(
'text-generation',
'Xenova/Llama-2-7b-chat-hf',
{ max_new_tokens: 150 }
);
this.isInitialized = true;
this.setupEventListeners();
this.animateCounters();
console.log('AI Assistant initialized successfully');
} catch (error) {
console.error('Error initializing AI:', error);
this.showFallback();
}
}
setupEventListeners() {
const chatInput = document.getElementById('chat-input');
const sendButton = document.getElementById('send-button');
const donationForm = document.getElementById('donation-form');
const aiDonateBtn = document.getElementById('ai-donate-btn');
chatInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') this.handleChatMessage();
});
sendButton.addEventListener('click', () => this.handleChatMessage());
donationForm.addEventListener('submit', (e) => this.handleDonation(e));
aiDonateBtn.addEventListener('click', () => this.optimizeDonation());
}
async handleChatMessage() {
if (!this.isInitialized) {
this.addChatMessage('System initializing... Please try again in a moment.', 'ai');
return;
}
const input = document.getElementById('chat-input');
const message = input.value.trim();
if (!message) return;
this.addChatMessage(message, 'user');
input.value = '';
try {
const response = await this.generateResponse(message);
this.addChatMessage(response, 'ai');
} catch (error) {
console.error('Chat error:', error);
this.addChatMessage('I apologize, but I\'m experiencing technical difficulties. Please try again.', 'ai');
}
}
async generateResponse(message) {
// Analyze sentiment for personalized responses
const sentiment = await this.sentimentAnalyzer(message);
const isPositive = sentiment[0].label === 'POSITIVE';
// Generate contextual response
const context = `You are Elon Musk's AI charity assistant. The user asked: ${message}.
Provide helpful, empathetic advice about maximizing humanitarian impact in Yemen and Gaza.`;
const response = await this.chatbot(context);
return response[0]?.generated_text?.split('\n').pop() ||
'Thank you for your interest in helping. Every donation makes a difference.';
}
addChatMessage(message, sender) {
const chatContainer = document.getElementById('chat-messages');
const messageDiv = document.createElement('div');
messageDiv.className = `chat-message ${sender}`;
messageDiv.textContent = message;
chatContainer.appendChild(messageDiv);
chatContainer.scrollTop = chatContainer.scrollHeight;
}
async handleDonation(e) {
e.preventDefault();
const amount = document.getElementById('donation-amount').value;
const currency = document.getElementById('donation-currency').value;
const cause = document.getElementById('donation-cause').value;
document.getElementById('processing').classList.remove('hidden');
document.getElementById('donation-form').classList.add('hidden');
// Simulate AI processing
await new Promise(resolve => setTimeout(resolve, 2000));
// Generate AI-optimized donation allocation
const allocation = await this.optimizeDonationAllocation(amount, cause);
this.showDonationSuccess(allocation);
}
async optimizeDonationAllocation(amount, cause) {
if (cause === 'auto') {
// Use AI to determine optimal split
const yemenNeed = Math.random() * 0.6 + 0.3; // Simulate need analysis
const gazaNeed = 1 - yemenNeed;
return {
yemen: Math.round(amount * yemenNeed * 100) / 100,
gaza: Math.round(amount * gazaNeed * 100) / 100
};
}
return {
[cause]: parseFloat(amount),
[cause === 'yemen' ? 'gaza' : 'yemen']: 0
};
}
showDonationSuccess(allocation) {
document.getElementById('processing').classList.add('hidden');
const successDiv = document.createElement('div');
successDiv.className = 'donation-success';
successDiv.innerHTML = `
<h3>Thank you for your donation!</h3>
<p>AI-optimized allocation:</p>
<ul>
<li>Yemen Relief: $${allocation.yemen || 0}</li>
<li>Gaza Support: $${allocation.gaza || 0}</li>
</ul>
`;
document.querySelector('.donation-form .container').appendChild(successDiv);
}
async optimizeDonation() {
const amount = prompt('Enter donation amount:');
if (!amount || isNaN(amount)) return;
const allocation = await this.optimizeDonationAllocation(amount, 'auto');
alert(`AI recommends:\nYemen Relief: $${allocation.yemen}\nGaza Support: $${allocation.gaza}`);
}
animateCounters() {
const animateValue = (id, start, end, duration, suffix = '') => {
const element = document.getElementById(id);
const range = end - start;
const increment = range / (duration / 16);
let current = start;
const timer = setInterval(() => {
current += increment;
if (current >= end) {
current = end;
clearInterval(timer);
}
element.textContent = (id === 'total-donations' ? '$' : '') +
Math.floor(current).toLocaleString() + suffix;
}, 16);
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
animateValue('total-donations', 0, 2500000, 2000);
animateValue('lives-impacted', 0, 50000, 2000, '+');
observer.disconnect();
}
});
});
observer.observe(document.querySelector('.hero-stats'));
}
showFallback() {
document.querySelector('.ai-assistant').innerHTML = `
<div class="container">
<h2>Donation Assistant</h2>
<p>Our AI assistant is temporarily unavailable. Please proceed with your donation below.</p>
</div>
`;
}
}
// Mobile menu toggle
document.querySelector('.mobile-menu-toggle').addEventListener('click', function() {
document.querySelector('.nav-links').classList.toggle('active');
});
// Initialize the application
new AIDonationAssistant();
=== style.css ===
/* style.css */
:root {
--primary-color: #1E90FF;
--secondary-color: #FFD700;
--accent-color: #32CD32;
--text-dark: #333;
--text-light: #666;
--bg-light: #f8f9fa;
--white: #ffffff;
--shadow: 0 2px 10px rgba(0,0,0,0.1);
--border-radius: 8px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Open Sans', sans-serif;
line-height: 1.6;
color: var(--text-dark);
}
h1, h2, h3 {
font-family: 'Montserrat', sans-serif;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header & Navigation */
header {
background: var(--white);
box-shadow: var(--shadow);
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
}
.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
}
.logo h1 {
font-size: 1.5rem;
color: var(--primary-color);
}
.tagline {
font-size: 0.8rem;
color: var(--text-light);
}
.nav-links {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-links a {
text-decoration: none;
color: var(--text-dark);
font-weight: 500;
transition: color 0.3s;
}
.nav-links a:hover {
color: var(--primary-color);
}
.mobile-menu-toggle {
display: none;
flex-direction: column;
background: none;
border: none;
cursor: pointer;
}
.mobile-menu-toggle span {
width: 25px;
height: 3px;
background: var(--text-dark);
margin: 3px 0;
transition: 0.3s;
}
/* Hero Section */
.hero {
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
color: var(--white);
padding: 8rem 2rem 4rem;
text-align: center;
margin-top: 60px;
}
.hero h1 {
font-size: 3rem;
margin-bottom: 1rem;
}
.hero p {
font-size: 1.2rem;
margin-bottom: 2rem;
}
.cta-button {
background: var(--secondary-color);
color: var(--text-dark);
padding: 1rem 2rem;
border: none;
border-radius: var(--border-radius);
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: transform 0.3s;
}
.cta-button:hover {
transform: translateY(-2px);
}
.hero-stats {
display: flex;
justify-content: center;
gap: 4rem;
margin-top: 3rem;
}
.stat {
text-align: center;
}
.stat-number {
display: block;
font-size: 2.5rem;
font-weight: 700;
}
.stat-label {
font-size: 0.9rem;
opacity: 0.9;
}
/* AI Assistant Section */
.ai-assistant {
padding: 4rem 0;
background: var(--bg-light);
}
.chat-container {
max-width: 600px;
margin: 0 auto;
background: var(--white);
border-radius: var(--border-radius);
box-shadow: var(--shadow);
}
#chat-messages {
height: 300px;
overflow-y: auto;
padding: 1rem;
border-bottom: 1px solid #eee;
}
.chat-message {
margin-bottom: 1rem;
padding: 0.5rem 1rem;
border-radius: var(--border-radius);
}
.chat-message.user {
background: var(--primary-color);
color: var(--white);
margin-left: 20%;
}
.chat-message.ai {
background: var(--bg-light);
margin-right: 20%;
}
.chat-input-container {
display: flex;
padding: 1rem;
gap: 0.5rem;
}
#chat-input {
flex: 1;
padding: 0.5rem;
border: 1px solid #ddd;
border-radius: var(--border-radius);
}
#send-button {
padding: 0.5rem 1rem;
background: var(--primary-color);
color: var(--white);
border: none;
border-radius: var(--border-radius);
cursor: pointer;
}
/* Mission Section */
.mission {
padding: 4rem 0;
}
.mission h2 {
text-align: center;
margin-bottom: 2rem;
}
.mission-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
}
.mission-card {
background: var(--white);
padding: 2rem;
border-radius: var(--border-radius);
box-shadow: var(--shadow);
text-align: center;
}
.progress-bar {
background: #eee;
height: 8px;
border-radius: 4px;
margin: 1rem 0;
overflow: hidden;
}
.progress {
background: var(--accent-color);
height: 100%;
transition: width 1s ease;
}
/* Donation Form */
.donation-form {
padding: 4rem 0;
background: var(--bg-light);
}
.donation-form h2 {
text-align: center;
margin-bottom: 2rem;
}
#donation-form {
max-width: 400px;
margin: 0 auto;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 600;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.75rem;
border: 1px solid #ddd;
border-radius: var(--border-radius);
font-size: 1rem;
}
.submit-btn {
width: 100%;
padding: 1rem;
background: var(--primary-color);
color: var(--white);
border: none;
border-radius: var(--border-radius);
font-size: 1.1rem;
cursor: pointer;
transition: background 0.3s;
}
.submit-btn:hover {
background: #1976D2;
}
.hidden {
display: none;
}
.spinner {
border: 3px solid #f3f3f3;
border-top: 3px solid var(--primary-color);
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 1rem;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.donation-success {
background: var(--white);
padding: 2rem;
border-radius: var(--border-radius);
box-shadow: var(--shadow);
text-align: center;
margin-top: 2rem;
}
/* Footer */
footer {
background: var(--text-dark);
color: var(--white);
text-align: center;
padding: 2rem 0;
}
.social-links {
margin-top: 1rem;
}
.social-links a {
color: var(--white);
margin: 0 1rem;
text-decoration: none;
}
/* Responsive Design */
@media (max-width: 768px) {
.nav-links {
display: none;
position: absolute;
top: 100%;
left: 0;
width: 100%;
background: var(--white);
flex-direction: column;
padding: 1rem;
box-shadow: var(--shadow);
}
.nav-links.active {
display: flex;
}
.mobile-menu-toggle {
display: flex;
}
.hero h1 {
font-size: 2rem;
}
.hero-stats {
flex-direction: column;
gap: 2rem;
}
.mission-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 480px) {
.hero {
padding: 6rem 1rem 2rem;
}
.container {
padding: 0 15px;
}
} |