CodeLens
— یادگیری کدنویسی
آموزش
دروس
مدیریت فایل
default
تغییر پروژه
اجرای کد
پنجره جدید
ذخیره
بازگردانی
تاریخچه
جزئی
بازنشانی کامل
کپی
بستن همه
✅ ذخیره شد
HTML
ساختار
▼
<!DOCTYPE html> <html lang="fa" dir="rtl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CodeLens - یادگیری کدنویسی</title> <link rel="stylesheet" href="style.css"> </head> <body> <!-- ====== HEADER ====== --> <header id="header"> <div class="header-content"> <div class="logo"> <span class="logo-icon"></></span> <span class="logo-text">Code<span class="highlight">Lens</span></span> </div> <nav> <button class="nav-btn" onclick="scrollToSection('home')">خانه</button> <button class="nav-btn" onclick="scrollToSection('about')">درباره</button> <button class="nav-btn" onclick="scrollToSection('services')">خدمات</button> <button class="nav-btn" onclick="scrollToSection('contact')">تماس</button> <button class="nav-btn" style="background: var(--color-html); color: #fff; border-radius: 8px; padding: 8px 20px;" onclick="goToEmner()"> 📚 Emner </button> </nav> <button class="menu-toggle" onclick="toggleMenu()">☰</button> </div> </header> <!-- ====== HERO SECTION ====== --> <section id="home" class="hero"> <div class="hero-content"> <h1>به <span class="highlight">CodeLens</span> خوش آمدید</h1> <p>یادگیری کدنویسی به روشی ساده و تعاملی</p> <div class="hero-buttons"> <button class="btn btn-primary" onclick="goToEmner()">📚 Emner</button> <button class="btn btn-secondary" onclick="toggleDarkMode()">🌙 حالت تاریک</button> </div> </div> <div class="hero-image"> <img src="../image/image.jpg" alt="Coding" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22400%22 height=%22300%22%3E%3Crect fill=%22%2316213e%22 width=%22400%22 height=%22300%22/%3E%3Ctext x=%2250%22 y=%22150%22 fill=%22%2353d8fb%22 font-size=%2230%22 font-family=%22sans-serif%22%3ECode%3C/text%3E%3C/svg%3E'"> </div> </section> <!-- ====== ABOUT SECTION ====== --> <section id="about" class="about"> <h2>📚 درباره ما</h2> <p>ما به شما کمک میکنیم تا <span class="highlight">HTML</span>، <span class="highlight-css">CSS</span> و <span class="highlight-js">JavaScript</span> را به زبان ساده یاد بگیرید.</p> <div class="about-grid"> <div class="about-card" onclick="toggleCard(this)"> <div class="card-icon">📄</div> <h3>HTML</h3> <p>ساختار صفحات وب</p> <div class="card-details"> <ul> <li>تگها و عناصر</li> <li>ویژگیها</li> <li>ساختار صفحه</li> </ul> </div> </div> <div class="about-card" onclick="toggleCard(this)"> <div class="card-icon">🎨</div> <h3>CSS</h3> <p>استایل و طراحی</p> <div class="card-details"> <ul> <li>رنگها و فونتها</li> <li>چیدمان (Flexbox)</li> <li>انیمیشن</li> </ul> </div> </div> <div class="about-card" onclick="toggleCard(this)"> <div class="card-icon">⚡</div> <h3>JavaScript</h3> <p>تعامل و پویایی</p> <div class="card-details"> <ul> <li>متغیرها و توابع</li> <li>رویدادها</li> <li>DOM manipulation</li> </ul> </div> </div> </div> </section> <!-- ====== SERVICES SECTION ====== --> <section id="services" class="services"> <h2>🛠️ امکانات</h2> <div class="services-grid"> <div class="service-item"> <span class="service-icon">✏️</span> <h3>ویرایشگر کد</h3> <p>کد را در مرورگر ویرایش کنید</p> </div> <div class="service-item"> <span class="service-icon">👁️</span> <h3>پیشنمایش زنده</h3> <p>تغییرات را بلافاصله ببینید</p> </div> <div class="service-item"> <span class="service-icon">💾</span> <h3>ذخیره خودکار</h3> <p>کد شما به طور خودکار ذخیره میشود</p> </div> <div class="service-item"> <span class="service-icon">📚</span> <h3>دورههای آموزشی</h3> <p>مباحث گام به گام</p> </div> <div class="service-item"> <span class="service-icon">🎯</span> <h3>تمرین عملی</h3> <p>با مثالهای واقعی تمرین کنید</p> </div> <div class="service-item"> <span class="service-icon">🌐</span> <h3>پشتیبانی از فارسی</h3> <p>توضیحات به زبان فارسی</p> </div> </div> </section> <!-- ====== COUNTER SECTION ====== --> <section class="counter-section"> <div class="counter-grid"> <div class="counter-item"> <span class="counter-number" id="counter1">0</span> <span class="counter-label">دانشجو</span> </div> <div class="counter-item"> <span class="counter-number" id="counter2">0</span> <span class="counter-label">دوره</span> </div> <div class="counter-item"> <span class="counter-number" id="counter3">0</span> <span class="counter-label">تمرین</span> </div> <div class="counter-item"> <span class="counter-number" id="counter4">0</span> <span class="counter-label">پروژه</span> </div> </div> </section> <!-- ====== ACCORDION / FAQ ====== --> <section class="faq-section"> <h2>❓ سوالات متداول</h2> <div class="accordion"> <div class="accordion-item" onclick="toggleAccordion(this)"> <div class="accordion-header"> <span>HTML چیست؟</span> <span class="accordion-icon">▼</span> </div> <div class="accordion-body"> <p>HTML (HyperText Markup Language) زبان اصلی ساختاردهی صفحات وب است. با استفاده از تگها، محتوای صفحه را سازماندهی میکنید.</p> </div> </div> <div class="accordion-item" onclick="toggleAccordion(this)"> <div class="accordion-header"> <span>CSS چه کاربردی دارد؟</span> <span class="accordion-icon">▼</span> </div> <div class="accordion-body"> <p>CSS (Cascading Style Sheets) برای زیباسازی و استایلدهی به صفحات وب استفاده میشود. رنگها، فونتها، چیدمان و انیمیشنها با CSS کنترل میشوند.</p> </div> </div> <div class="accordion-item" onclick="toggleAccordion(this)"> <div class="accordion-header"> <span>چرا JavaScript یاد بگیریم؟</span> <span class="accordion-icon">▼</span> </div> <div class="accordion-body"> <p>JavaScript به صفحات وب قابلیت تعامل و پویایی میدهد. با JS میتوانید به رویدادهای کاربر پاسخ دهید، محتوا را تغییر دهید و با سرور ارتباط برقرار کنید.</p> </div> </div> <div class="accordion-item" onclick="toggleAccordion(this)"> <div class="accordion-header"> <span>چقدر زمان نیاز است؟</span> <span class="accordion-icon">▼</span> </div> <div class="accordion-body"> <p>با تمرین روزانه، میتوانید در ۲ تا ۳ ماه به سطح متوسط برسید. مهمترین چیز <span class="highlight">تمرین مستمر</span> است.</p> </div> </div> </div> </section> <!-- ====== IMAGE GALLERY ====== --> <section class="gallery-section"> <h2>🖼️ گالری تصاویر</h2> <div class="gallery-grid"> <div class="gallery-item" onclick="openLightbox(this)"> <img src="../image/image.jpg" alt="Coding 1" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22150%22%3E%3Crect fill=%22%2316213e%22 width=%22200%22 height=%22150%22/%3E%3Ctext x=%2250%22 y=%2290%22 fill=%22%2353d8fb%22 font-size=%2220%22 font-family=%22sans-serif%22%3EImg%3C/text%3E%3C/svg%3E'"> <div class="gallery-overlay">تصویر ۱</div> </div> <div class="gallery-item" onclick="openLightbox(this)"> <img src="../image/image.jpg" alt="Coding 2" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22150%22%3E%3Crect fill=%22%2316213e%22 width=%22200%22 height=%22150%22/%3E%3Ctext x=%2250%22 y=%2290%22 fill=%22%2353d8fb%22 font-size=%2220%22 font-family=%22sans-serif%22%3EImg%3C/text%3E%3C/svg%3E'"> <div class="gallery-overlay">تصویر ۲</div> </div> <div class="gallery-item" onclick="openLightbox(this)"> <img src="../image/image.jpg" alt="Coding 3" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22150%22%3E%3Crect fill=%22%2316213e%22 width=%22200%22 height=%22150%22/%3E%3Ctext x=%2250%22 y=%2290%22 fill=%22%2353d8fb%22 font-size=%2220%22 font-family=%22sans-serif%22%3EImg%3C/text%3E%3C/svg%3E'"> <div class="gallery-overlay">تصویر ۳</div> </div> <div class="gallery-item" onclick="openLightbox(this)"> <img src="../image/image.jpg" alt="Coding 4" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22150%22%3E%3Crect fill=%22%2316213e%22 width=%22200%22 height=%22150%22/%3E%3Ctext x=%2250%22 y=%2290%22 fill=%22%2353d8fb%22 font-size=%2220%22 font-family=%22sans-serif%22%3EImg%3C/text%3E%3C/svg%3E'"> <div class="gallery-overlay">تصویر ۴</div> </div> </div> </section> <!-- ====== CONTACT SECTION ====== --> <section id="contact" class="contact"> <h2>📬 تماس با ما</h2> <form onsubmit="handleSubmit(event)"> <div class="form-group"> <label>نام شما</label> <input type="text" id="name" placeholder="نام خود را وارد کنید" required> </div> <div class="form-group"> <label>ایمیل</label> <input type="email" id="email" placeholder="ایمیل خود را وارد کنید" required> </div> <div class="form-group"> <label>پیام</label> <textarea id="message" rows="4" placeholder="پیام خود را بنویسید" required></textarea> </div> <button type="submit" class="btn btn-primary">ارسال پیام</button> </form> </section> <!-- ====== FOOTER ====== --> <footer> <div class="footer-content"> <div class="footer-section"> <h4>CodeLens</h4> <p>یادگیری کدنویسی به روشی ساده و تعاملی</p> </div> <div class="footer-section"> <h4>لینکها</h4> <a href="#home">خانه</a> <a href="#about">درباره</a> <a href="#services">خدمات</a> <a href="#contact">تماس</a> <a href="../learn/index.html">📚 Emner</a> </div> <div class="footer-section"> <h4>دنبال کنید</h4> <div class="social-links"> <a href="#">📘</a> <a href="#">🐦</a> <a href="#">📸</a> <a href="#">💼</a> </div> </div> </div> <div class="footer-bottom"> <p>© 2026 CodeLens. تمامی حقوق محفوظ است.</p> </div> </footer> <!-- ====== LIGHTBOX ====== --> <div id="lightbox" class="lightbox" onclick="closeLightbox()"> <span class="lightbox-close">×</span> <img class="lightbox-content" id="lightbox-img"> </div> <!-- ====== TOAST NOTIFICATION ====== --> <div id="toast" class="toast"></div> <script src="script.js"></script> </body> </html>
CSS
استایلدهی
▼
/* ====== CodeLens - Complete Styling ====== */ /* All styling for the learning platform */ :root { --bg-primary: #f0f2f5; --bg-secondary: #ffffff; --bg-dark: #1a1a2e; --bg-card: #16213e; --text-primary: #333333; --text-secondary: #666666; --text-light: #ffffff; --color-html: #e94560; --color-css: #53d8fb; --color-js: #fd971f; --shadow: 0 4px 20px rgba(0,0,0,0.1); --radius: 12px; --transition: all 0.3s ease; } /* ====== DARK MODE ====== */ body.dark-mode { --bg-primary: #0d0d1a; --bg-secondary: #16213e; --text-primary: #e0e0e0; --text-secondary: #a0a0a0; } /* ====== RESET ====== */ * { margin: 0; padding: 0; box-sizing: border-box; } html { scroll-behavior: smooth; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; transition: var(--transition); padding-top: 70px; } /* ====== HEADER ====== */ #header { position: fixed; top: 0; left: 0; right: 0; background: var(--bg-secondary); box-shadow: var(--shadow); z-index: 1000; padding: 0 20px; transition: var(--transition); } .header-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 70px; } .logo { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: bold; } .logo-icon { background: var(--color-html); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 1.2rem; } .logo-text .highlight { color: var(--color-html); } nav { display: flex; gap: 10px; } .nav-btn { background: none; border: none; padding: 8px 16px; cursor: pointer; font-size: 0.95rem; color: var(--text-primary); border-radius: 6px; transition: var(--transition); } .nav-btn:hover { background: var(--color-html); color: #fff; } .menu-toggle { display: none; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-primary); } /* ====== HERO ====== */ .hero { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; max-width: 1200px; margin: 0 auto; padding: 60px 20px; align-items: center; min-height: 80vh; } .hero-content h1 { font-size: 3rem; margin-bottom: 15px; } .hero-content h1 .highlight { color: var(--color-html); } .hero-content p { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 25px; } .hero-buttons { display: flex; gap: 15px; flex-wrap: wrap; } .btn { padding: 12px 30px; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; transition: var(--transition); font-weight: 600; } .btn-primary { background: var(--color-html); color: #fff; } .btn-primary:hover { background: #c73652; transform: translateY(-2px); box-shadow: 0 6px 25px rgba(233, 69, 96, 0.4); } .btn-secondary { background: var(--bg-dark); color: #fff; } .btn-secondary:hover { background: #2a2a4a; transform: translateY(-2px); } .hero-image img { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); } /* ====== SECTIONS ====== */ section { max-width: 1200px; margin: 0 auto; padding: 60px 20px; } section h2 { font-size: 2.2rem; margin-bottom: 30px; text-align: center; } .highlight { color: var(--color-html); } .highlight-css { color: var(--color-css); } .highlight-js { color: var(--color-js); } /* ====== ABOUT ====== */ .about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; margin-top: 20px; } .about-card { background: var(--bg-secondary); padding: 30px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); cursor: pointer; transition: var(--transition); border-top: 4px solid var(--color-html); } .about-card:hover { transform: translateY(-5px); box-shadow: 0 8px 30px rgba(0,0,0,0.15); } .about-card:nth-child(2) { border-top-color: var(--color-css); } .about-card:nth-child(3) { border-top-color: var(--color-js); } .card-icon { font-size: 3rem; display: block; margin-bottom: 10px; } .about-card h3 { margin-bottom: 8px; } .card-details { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; } .card-details.open { max-height: 200px; } .card-details ul { list-style: none; padding: 10px 0; } .card-details li { padding: 5px 0; border-bottom: 1px solid #eee; } /* ====== SERVICES ====== */ .services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; } .service-item { background: var(--bg-secondary); padding: 25px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); transition: var(--transition); } .service-item:hover { transform: translateY(-3px); box-shadow: 0 6px 25px rgba(0,0,0,0.12); } .service-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; } /* ====== COUNTER ====== */ .counter-section { background: var(--bg-dark); color: #fff; border-radius: var(--radius); margin: 20px auto; padding: 40px 20px; } .counter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; } .counter-number { font-size: 3rem; font-weight: bold; color: var(--color-css); display: block; } .counter-label { font-size: 1rem; opacity: 0.8; } /* ====== ACCORDION / FAQ ====== */ .faq-section { background: var(--bg-secondary); border-radius: var(--radius); padding: 40px 20px; box-shadow: var(--shadow); } .accordion-item { border-bottom: 1px solid #ddd; cursor: pointer; } .accordion-item:last-child { border-bottom: none; } .accordion-header { padding: 15px 0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 1.05rem; } .accordion-icon { transition: transform 0.3s ease; } .accordion-item.open .accordion-icon { transform: rotate(180deg); } .accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; padding: 0 10px; } .accordion-item.open .accordion-body { max-height: 200px; padding: 10px 10px 20px; } /* ====== GALLERY ====== */ .gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; } .gallery-item { position: relative; overflow: hidden; border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow); } .gallery-item img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.4s ease; } .gallery-item:hover img { transform: scale(1.05); } .gallery-overlay { position: absolute; bottom: -50px; left: 0; right: 0; background: rgba(0,0,0,0.7); color: #fff; padding: 10px; text-align: center; transition: bottom 0.3s ease; } .gallery-item:hover .gallery-overlay { bottom: 0; } /* ====== LIGHTBOX ====== */ .lightbox { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.9); z-index: 9999; justify-content: center; align-items: center; } .lightbox.show { display: flex; } .lightbox-content { max-width: 80%; max-height: 80%; border-radius: 8px; } .lightbox-close { position: absolute; top: 30px; right: 40px; font-size: 3rem; color: #fff; cursor: pointer; transition: var(--transition); } .lightbox-close:hover { color: var(--color-html); transform: rotate(90deg); } /* ====== CONTACT ====== */ .contact { background: var(--bg-secondary); border-radius: var(--radius); padding: 40px 20px; box-shadow: var(--shadow); } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 5px; font-weight: 600; } .form-group input, .form-group textarea { width: 100%; padding: 12px 16px; border: 2px solid #ddd; border-radius: 8px; font-size: 1rem; background: var(--bg-primary); color: var(--text-primary); transition: var(--transition); } .form-group input:focus, .form-group textarea:focus { border-color: var(--color-html); outline: none; box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2); } /* ====== FOOTER ====== */ footer { background: var(--bg-dark); color: #e0e0e0; margin-top: 40px; } .footer-content { max-width: 1200px; margin: 0 auto; padding: 40px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; } .footer-section h4 { color: #fff; margin-bottom: 15px; } .footer-section a { display: block; color: #a0a0a0; text-decoration: none; padding: 5px 0; transition: var(--transition); } .footer-section a:hover { color: var(--color-css); } .social-links { display: flex; gap: 15px; } .social-links a { font-size: 1.8rem; text-decoration: none; } .footer-bottom { text-align: center; padding: 20px; border-top: 1px solid #2a2a4a; color: #666; } /* ====== TOAST ====== */ .toast { position: fixed; bottom: 30px; right: 30px; padding: 15px 25px; border-radius: 8px; color: #fff; font-weight: 500; z-index: 9998; transform: translateY(100px); opacity: 0; transition: all 0.4s ease; max-width: 400px; } .toast.show { transform: translateY(0); opacity: 1; } .toast.success { background: #2d5a4e; } .toast.error { background: #5a2a4e; } .toast.info { background: #2a4a5e; } .toast.warning { background: #5a4a2e; } /* ====== RESPONSIVE ====== */ @media (max-width: 992px) { .hero { grid-template-columns: 1fr; text-align: center; } .hero-buttons { justify-content: center; } } @media (max-width: 768px) { nav { display: none; } nav.open { display: flex; flex-direction: column; position: absolute; top: 70px; left: 0; right: 0; background: var(--bg-secondary); padding: 20px; box-shadow: var(--shadow); } .menu-toggle { display: block; } .counter-grid { grid-template-columns: repeat(2, 1fr); } .hero-content h1 { font-size: 2rem; } } @media (max-width: 480px) { .about-grid { grid-template-columns: 1fr; } .services-grid { grid-template-columns: 1fr 1fr; } .gallery-grid { grid-template-columns: 1fr 1fr; } .footer-content { grid-template-columns: 1fr; text-align: center; } .social-links { justify-content: center; } }
JavaScript
تعامل
▼
// ====== CodeLens - Complete JavaScript ====== // ====== TOGGLE MENU ====== function toggleMenu() { const nav = document.querySelector('nav'); if (nav) nav.classList.toggle('open'); } // ====== SCROLL TO SECTION ====== function scrollToSection(id) { const element = document.getElementById(id); if (element) { element.scrollIntoView({ behavior: 'smooth', block: 'start' }); } const nav = document.querySelector('nav'); if (nav) nav.classList.remove('open'); } // ====== GO TO EMNER (LEARN) ====== function goToEmner() { showToast('📚 به بخش آموزش خوش آمدید!', 'success'); setTimeout(() => { window.location.href = 'learn/index.html'; }, 1000); } // ====== TOGGLE CARD DETAILS ====== function toggleCard(card) { const details = card.querySelector('.card-details'); if (details) { details.classList.toggle('open'); } } // ====== TOGGLE ACCORDION ====== function toggleAccordion(item) { item.classList.toggle('open'); const parent = item.parentElement; if (parent) { parent.querySelectorAll('.accordion-item').forEach(other => { if (other !== item) { other.classList.remove('open'); } }); } } // ====== TOGGLE DARK MODE ====== function toggleDarkMode() { document.body.classList.toggle('dark-mode'); const btn = document.querySelector('.btn-secondary'); if (btn) { if (document.body.classList.contains('dark-mode')) { btn.textContent = '☀️ حالت روشن'; showToast('🌙 حالت تاریک فعال شد', 'info'); } else { btn.textContent = '🌙 حالت تاریک'; showToast('☀️ حالت روشن فعال شد', 'info'); } } } // ====== COUNTER ANIMATION ====== function animateCounters() { const counters = document.querySelectorAll('.counter-number'); counters.forEach(counter => { const target = parseInt(counter.textContent) || 100; let current = 0; const increment = Math.ceil(target / 50); const interval = setInterval(() => { current += increment; if (current >= target) { current = target; clearInterval(interval); } counter.textContent = current; }, 40); }); } // ====== LIGHTBOX ====== function openLightbox(item) { const img = item.querySelector('img'); if (!img) return; const lightbox = document.getElementById('lightbox'); const lightboxImg = document.getElementById('lightbox-img'); if (lightbox && lightboxImg) { lightboxImg.src = img.src; lightboxImg.alt = img.alt || 'Image'; lightbox.classList.add('show'); document.body.style.overflow = 'hidden'; } } function closeLightbox() { const lightbox = document.getElementById('lightbox'); if (lightbox) { lightbox.classList.remove('show'); document.body.style.overflow = ''; } } document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeLightbox(); } }); // ====== TOAST NOTIFICATION ====== function showToast(message, type = 'info') { const toast = document.getElementById('toast'); if (!toast) return; toast.textContent = message; toast.className = 'toast ' + type; void toast.offsetWidth; toast.classList.add('show'); clearTimeout(toast._timeout); toast._timeout = setTimeout(() => { toast.classList.remove('show'); }, 4000); } // ====== FORM HANDLING ====== function handleSubmit(event) { event.preventDefault(); const name = document.getElementById('name')?.value || ''; const email = document.getElementById('email')?.value || ''; const message = document.getElementById('message')?.value || ''; if (name && email && message) { showToast('✅ پیام شما با موفقیت ارسال شد!', 'success'); event.target.reset(); } else { showToast('❌ لطفاً همه فیلدها را پر کنید!', 'error'); } } // ====== SMOOTH SCROLL ====== document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function(e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth' }); } }); }); // ====== COUNTER OBSERVER ====== const counterObserver = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { animateCounters(); counterObserver.disconnect(); } }); }, { threshold: 0.5 }); // ====== DOM READY ====== document.addEventListener('DOMContentLoaded', function() { const counterSection = document.querySelector('.counter-section'); if (counterSection) { counterObserver.observe(counterSection); } setTimeout(() => { showToast('👋 به CodeLens خوش آمدید!', 'info'); }, 1000); }); // ====== CONSOLE INFO ====== console.log('%c CodeLens v3.0 ', 'background: #e94560; color: #fff; font-size: 20px; font-weight: bold; padding: 10px 15px; border-radius: 6px;'); console.log('%c 🎯 یادگیری کدنویسی به روشی ساده و تعاملی', 'color: #53d8fb; font-size: 14px;'); console.log('%c 📚 HTML | CSS | JavaScript', 'color: #fd971f; font-size: 13px;'); console.log('%c 📖 برای شروع، روی دکمه "Emner" کلیک کنید', 'color: #75715e; font-size: 12px;');
پیشنمایش زنده
تگهای HTML
انتخابگرهای CSS
متغیرهای JS
رشتهها/مقادیر
کامنتها
💾 تغییرات در پایگاه داده ذخیره میشود
پروژه:
default
انتخاب پروژه
—
×
تاریخچه نسخهها — default
×
تاریخچهای موجود نیست
بازگردانی جزئی
×
یک نسخه و بخش مورد نظر را انتخاب کنید:
—
—
ذخیره و بستن
کپی
بستن