Spaces:
Running
Running
Download script.js from badri123J/code-alchemy-by-badri: direct link, hf CLI and curl.
- Browser
- Download file 7.25 kB
-
https://huggingface.co/spaces/badri123J/code-alchemy-by-badri/resolve/main/script.js
- Command line
-
hf download hf://spaces/badri123J/code-alchemy-by-badri/script.js
-
curl -L -o script.js https://huggingface.co/spaces/badri123J/code-alchemy-by-badri/resolve/main/script.js
7.25 kB
| document.addEventListener('DOMContentLoaded', () => { | |
| // Typing Effect | |
| const typingElement = document.getElementById('typing'); | |
| const texts = ["Je suis Badri", "Développeur Web", "Développeur d'Applications", "Designer"]; | |
| let textIndex = 0; | |
| let charIndex = 0; | |
| let isDeleting = false; | |
| let typingSpeed = 100; | |
| function type() { | |
| const currentText = texts[textIndex]; | |
| if (isDeleting) { | |
| typingElement.textContent = currentText.substring(0, charIndex - 1); | |
| charIndex--; | |
| typingSpeed = 50; | |
| } else { | |
| typingElement.textContent = currentText.substring(0, charIndex + 1); | |
| charIndex++; | |
| typingSpeed = 100; | |
| } | |
| if (!isDeleting && charIndex === currentText.length) { | |
| isDeleting = true; | |
| typingSpeed = 1500; | |
| } else if (isDeleting && charIndex === 0) { | |
| isDeleting = false; | |
| textIndex = (textIndex + 1) % texts.length; | |
| typingSpeed = 500; | |
| } | |
| setTimeout(type, typingSpeed); | |
| } | |
| setTimeout(type, 1000); | |
| // Skills Data | |
| const skills = [ | |
| { name: 'HTML5', percentage: 99, icon: 'code' }, | |
| { name: 'CSS3', percentage: 99, icon: 'layout' }, | |
| { name: 'JavaScript', percentage: 92, icon: 'file-text' }, | |
| { name: 'React', percentage: 90, icon: 'react' }, | |
| { name: 'Vue.js', percentage: 90, icon: 'vue' }, | |
| { name: 'Node.js', percentage: 90, icon: 'server' }, | |
| { name: 'Django', percentage: 85, icon: 'database' }, | |
| { name: 'Firebase', percentage: 95, icon: 'fire' }, | |
| { name: 'Python', percentage: 90, icon: 'python' }, | |
| { name: 'Next.js', percentage: 75, icon: 'nextjs' }, | |
| { name: 'Git', percentage: 90, icon: 'git-branch' }, | |
| { name: 'GitHub', percentage: 95, icon: 'github' }, | |
| { name: 'Vercel', percentage: 90, icon: 'cloud' }, | |
| { name: 'Linux', percentage: 82, icon: 'terminal' }, | |
| { name: 'MongoDB', percentage: 85, icon: 'database' }, | |
| { name: 'Firebase Firestore', percentage: 95, icon: 'fire' }, | |
| { name: 'MySQL', percentage: 80, icon: 'database' } | |
| ]; | |
| // Projects Data | |
| const projects = [ | |
| { | |
| name: 'E-commerce Platform', | |
| description: 'Plateforme e-commerce complète avec panier, paiement et dashboard admin.', | |
| image: 'http://static.photos/retail/640x360/1', | |
| link: '#' | |
| }, | |
| { | |
| name: 'Réseau Social', | |
| description: 'Application de réseau social avec authentification et partage en temps réel.', | |
| image: 'http://static.photos/social/640x360/2', | |
| link: '#' | |
| }, | |
| { | |
| name: 'Application SaaS', | |
| description: 'Solution SaaS pour la gestion de projets avec équipes en temps réel.', | |
| image: 'http://static.photos/workspace/640x360/3', | |
| link: '#' | |
| }, | |
| { | |
| name: 'Portfolio Artistique', | |
| description: 'Site portfolio moderne pour un artiste avec galerie interactive.', | |
| image: 'http://static.photos/art/640x360/4', | |
| link: '#' | |
| }, | |
| { | |
| name: 'Dashboard Analytics', | |
| description: 'Tableau de bord analytique avec visualisation de données en temps réel.', | |
| image: 'http://static.photos/finance/640x360/5', | |
| link: '#' | |
| }, | |
| { | |
| name: 'Application Mobile', | |
| description: 'Application mobile multiplateforme pour le suivi de la forme physique.', | |
| image: 'http://static.photos/health/640x360/6', | |
| link: '#' | |
| } | |
| ]; | |
| // Render Skills | |
| const skillsContainer = document.querySelector('#skills .grid'); | |
| skills.forEach(skill => { | |
| const skillElement = document.createElement('div'); | |
| skillElement.className = 'skill-card p-6 bg-dark rounded-lg border border-gray-800 transition-all duration-300 fade-in'; | |
| skillElement.innerHTML = ` | |
| <div class="flex items-center mb-4"> | |
| <div class="bg-primary bg-opacity-10 p-3 rounded-full mr-4"> | |
| <i data-feather="${skill.icon}" class="text-primary"></i> | |
| </div> | |
| <h3 class="text-xl font-medium">${skill.name}</h3> | |
| </div> | |
| <div class="w-full bg-gray-800 rounded-full h-2.5"> | |
| <div class="bg-primary h-2.5 rounded-full" style="--progress-width: ${skill.percentage}%"></div> | |
| </div> | |
| <div class="flex justify-between mt-2 text-sm text-gray-400"> | |
| <span>Maîtrise</span> | |
| <span>${skill.percentage}%</span> | |
| </div> | |
| `; | |
| skillsContainer.appendChild(skillElement); | |
| }); | |
| // Render Projects | |
| const projectsContainer = document.querySelector('#projects .grid'); | |
| projects.forEach(project => { | |
| const projectElement = document.createElement('div'); | |
| projectElement.className = 'project-card bg-dark rounded-lg overflow-hidden border border-gray-800 fade-in'; | |
| projectElement.innerHTML = ` | |
| <div class="overflow-hidden"> | |
| <img src="${project.image}" alt="${project.name}" class="project-image w-full h-48 object-cover"> | |
| </div> | |
| <div class="p-6"> | |
| <h3 class="text-xl font-bold mb-2">${project.name}</h3> | |
| <p class="text-gray-400 mb-4">${project.description}</p> | |
| <a href="${project.link}" class="inline-flex items-center text-primary hover:text-purple-400 transition-colors"> | |
| Voir plus | |
| <i data-feather="arrow-right" class="ml-1 w-5 h-5"></i> | |
| </a> | |
| </div> | |
| `; | |
| projectsContainer.appendChild(projectElement); | |
| }); | |
| // Contact Form | |
| const contactForm = document.getElementById('contactForm'); | |
| contactForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const name = document.getElementById('name').value; | |
| const email = document.getElementById('email').value; | |
| const message = document.getElementById('message').value; | |
| console.log('Message envoyé:', { name, email, message }); | |
| alert('Message envoyé avec succès !'); | |
| contactForm.reset(); | |
| }); | |
| // Scroll Reveal Animation | |
| const revealElements = document.querySelectorAll('[data-reveal]'); | |
| const revealOnScroll = () => { | |
| for (let i = 0; i < revealElements.length; i++) { | |
| const element = revealElements[i]; | |
| const elementTop = element.getBoundingClientRect().top; | |
| const elementVisible = 150; | |
| if (elementTop < window.innerHeight - elementVisible) { | |
| element.setAttribute('data-reveal', 'true'); | |
| } | |
| } | |
| }; | |
| window.addEventListener('scroll', revealOnScroll); | |
| revealOnScroll(); | |
| // Animate progress bars | |
| const progressBars = document.querySelectorAll('[style*="--progress-width"]'); | |
| progressBars.forEach(bar => { | |
| bar.classList.add('animate-progress'); | |
| }); | |
| // Feather Icons | |
| feather.replace(); | |
| }); |