<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8" /> <meta name="viewport"…
- User
<!-- Google Fonts: Poppins --> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap" rel="stylesheet" /> <!-- Owl Carousel 2 CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" /> <!-- Font Awesome Icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" /> <style> /* ----- Reset & Fullscreen ----- */ * { margin: 0; padding: 0; box-sizing: border-box; } html, body { width: 100%; height: 100%; font-family: 'Poppins', sans-serif; background: #f5f7fa; overflow: hidden; } /* ----- Slider Konteynırı ----- */ .slider-wrapper { width: 100vw; height: 100vh; background: #ffffff; position: relative; overflow: hidden; } /* ----- Import Alanı (Sol Üst) ----- */ .import-area { position: absolute; top: 16px; left: 20px; z-index: 30; display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(8px); padding: 6px 16px 6px 20px; border-radius: 60px; border: 1px solid rgba(0, 0, 0, 0.04); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04); } .import-area .file-label { font-weight: 600; font-size: 0.85rem; color: #1e293b; cursor: pointer; display: flex; align-items: center; gap: 8px; } .import-area .file-label i { color: #4f6ef7; } .import-area input[type="file"] { display: none; } .import-area .badge { background: #eef2ff; color: #4f6ef7; padding: 2px 10px; border-radius: 30px; font-size: 0.7rem; font-weight: 700; } /* ----- Owl Carousel ----- */ .owl-carousel, .owl-stage-outer, .owl-stage, .owl-item { height: 100%; width: 100%; } .owl-item { display: flex; align-items: center; justify-content: center; } /* ----- Slayt Kartı ----- */ .slide-card { width: 100%; height: 100%; padding: 5% 8% 4% 8%; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(145deg, #ffffff 0%, #f8faff 100%); color: #1e2a3a; position: relative; overflow-y: auto; } .slide-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, #6c8cff, #a78bfa, #6c8cff); background-size: 200% 100%; animation: shine 4s linear infinite; } @keyframes shine { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } } .slide-title { font-weight: 900; font-size: clamp(2.4rem, 5.5vw, 5rem); letter-spacing: -0.02em; color: #1e293b; margin-bottom: 0.2rem; line-height: 1.15; flex-shrink: 0; } .slide-sub { font-weight: 600; font-size: clamp(1rem, 1.6vw, 1.5rem); color: #64748b; margin-bottom: 0.8rem; border-bottom: 2px solid #e9edf4; padding-bottom: 0.5rem; flex-shrink: 0; } .slide-content { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 0.6rem; } .big-text { font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 2rem); line-height: 1.5; color: #334155; } .highlight { background: rgba(108, 140, 255, 0.1); padding: 0.1rem 0.6rem; border-radius: 10px; font-weight: 800; color: #4f6ef7; } .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 2rem; } .grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem 1.2rem; } .table-card { background: #f8fafc; border-radius: 16px; padding: 0.8rem 1rem; border-left: 4px solid #6c8cff; font-weight: 600; font-size: clamp(0.9rem, 1.3vw, 1.2rem); color: #1e293b; display: flex; flex-direction: column; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02); } .table-card .label { font-weight: 800; color: #4f6ef7; } .table-card .detail { font-weight: 500; color: #64748b; font-size: clamp(0.8rem, 1.1vw, 1rem); } .custom-list { list-style: none; padding: 0; margin: 0.2rem 0; } .custom-list li { font-weight: 600; font-size: clamp(0.9rem, 1.4vw, 1.3rem); padding: 0.3rem 0 0.3rem 2rem; position: relative; line-height: 1.5; color: #334155; } .custom-list li::before { content: "▹"; position: absolute; left: 0; color: #6c8cff; font-weight: 900; font-size: clamp(1rem, 1.6vw, 1.6rem); } .phone-task-box { background: #f1f4f9; border-radius: 60px; border: 1px solid #e2e8f0; padding: 0.6rem 1.6rem; font-weight: 700; font-size: clamp(0.8rem, 1.2vw, 1.2rem); color: #1e293b; display: inline-flex; align-items: center; gap: 12px; margin-top: 0.4rem; flex-shrink: 0; } .phone-task-box::before { content: "📱"; font-size: clamp(1.2rem, 1.8vw, 2rem); } /* ----- Navigasyon Okları ----- */ .slider-wrapper .owl-nav { position: absolute; top: 50%; left: 0; width: 100%; transform: translateY(-50%); pointer-events: none; display: flex; justify-content: space-between; padding: 0 16px; z-index: 10; } .slider-wrapper .owl-nav button { pointer-events: all; background: rgba(255, 255, 255, 0.7) !important; backdrop-filter: blur(6px); border-radius: 60px !important; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 24px !important; color: #1e293b !important; border: 1px solid rgba(0, 0, 0, 0.06) !important; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important; transition: 0.25s ease; } .slider-wrapper .owl-nav button:hover { background: #ffffff !important; border-color: #6c8cff !important; transform: scale(1.05); box-shadow: 0 8px 24px rgba(108, 140, 255, 0.15) !important; } /* ----- Alt Noktalar ----- */ .slider-wrapper .owl-dots { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 10; background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(6px); padding: 6px 16px; border-radius: 60px; border: 1px solid rgba(0, 0, 0, 0.04); } .slider-wrapper .owl-dots .owl-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(30, 41, 59, 0.15); transition: 0.3s ease; border: none; cursor: pointer; } .slider-wrapper .owl-dots .owl-dot.active { background: #6c8cff; box-shadow: 0 0 16px rgba(108, 140, 255, 0.3); transform: scale(1.3); } /* ----- Alt Kontroller (Sağ) ----- */ .controls-bottom { position: absolute; bottom: 24px; right: 30px; z-index: 15; display: flex; gap: 10px; align-items: center; } .controls-bottom button { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(6px); border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 60px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #1e293b; cursor: pointer; transition: 0.25s ease; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04); } .controls-bottom button:hover { background: #ffffff; border-color: #6c8cff; transform: scale(1.05); box-shadow: 0 8px 24px rgba(108, 140, 255, 0.15); } .controls-bottom button.active { background: #6c8cff; color: #fff; border-color: #6c8cff; } /* ----- MP3 Yönetim Paneli ----- */ .mp3-manager { position: absolute; bottom: 80px; right: 30px; z-index: 20; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px); border-radius: 20px; padding: 16px 20px; border: 1px solid rgba(0, 0, 0, 0.04); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08); width: 300px; display: none; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; } .mp3-manager.open { display: flex; } .mp3-manager .title { font-weight: 700; font-size: 0.9rem; color: #1e293b; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; } .mp3-manager .title .close-btn { background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1rem; } .mp3-manager .title .close-btn:hover { color: #1e293b; } .mp3-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #334155; padding: 4px 0; border-bottom: 1px solid #f1f5f9; } .mp3-item .slide-label { font-weight: 600; min-width: 28px; color: #4f6ef7; } .mp3-item input[type="file"] { font-size: 0.7rem; flex: 1; max-width: 120px; } .mp3-item .status { font-size: 0.7rem; color: #22c55e; } .mp3-item .status.empty { color: #94a3b8; } .mp3-item .remove-mp3 { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 0.8rem; } /* ----- Fullscreen modunda kontroller gizlenir (hover ile görünür) ----- */ .slider-wrapper.fullscreen-mode .owl-nav button, .slider-wrapper.fullscreen-mode .owl-dots, .slider-wrapper.fullscreen-mode .controls-bottom, .slider-wrapper.fullscreen-mode .mp3-manager { opacity: 0; transition: opacity 0.3s; } .slider-wrapper.fullscreen-mode:hover .owl-nav button, .slider-wrapper.fullscreen-mode:hover .owl-dots, .slider-wrapper.fullscreen-mode:hover .controls-bottom, .slider-wrapper.fullscreen-mode:hover .mp3-manager { opacity: 1; } /* ----- Toast mesajı ----- */ .toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; padding: 10px 24px; border-radius: 40px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2); z-index: 9999; opacity: 0; transition: opacity 0.3s; pointer-events: none; font-size: 0.9rem; } .toast.show { opacity: 1; } /* ----- Responsive ----- */ @media (max-width: 900px) { .slide-card { padding: 4% 5% 3% 5%; } .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; gap: 0.8rem; } .mp3-manager { width: 240px; right: 16px; bottom: 70px; } .import-area { top: 12px; left: 12px; padding: 4px 12px 4px 16px; font-size: 0.8rem; } } @media (max-width: 640px) { .grid-2, .grid-4 { grid-template-columns: 1fr; gap: 0.6rem; } .slide-title { font-size: clamp(1.8rem, 8vw, 2.8rem); } .slider-wrapper .owl-nav button { width: 36px; height: 36px; font-size: 18px !important; } .controls-bottom button { width: 34px; height: 34px; font-size: 0.9rem; } .controls-bottom { right: 16px; bottom: 16px; } .slider-wrapper .owl-dots { bottom: 16px; padding: 4px 12px; gap: 6px; } .slider-wrapper .owl-dots .owl-dot { width: 8px; height: 8px; } .slide-card { padding: 5% 4% 3% 4%; } .mp3-manager { width: 200px; right: 10px; bottom: 60px; padding: 12px; } .import-area { top: 8px; left: 8px; padding: 4px 8px 4px 12px; font-size: 0.7rem; } .import-area .badge { display: none; } } .mp3-manager::-webkit-scrollbar { width: 4px; } .mp3-manager::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; } </style><div class="slider-wrapper" id="sliderWrapper"> <!-- ----- Import Alanı (Sol Üst) ----- --> <div class="import-area"> <label class="file-label" for="fileInput"> <i class="fas fa-file-import"></i> Dosya İçe Aktar <span class="badge" id="slideCountBadge">0 slayt</span> </label> <input type="file" id="fileInput" accept=".html,.htm" /> </div> <!-- ----- Owl Carousel ----- --> <div class="owl-carousel owl-theme" id="mainSlider"> <!-- Örnek slaytlar (başlangıç) --> <div class="slide-card" data-slide="0"> <div class="slide-title">🎵 Şarkılarla İngilizce</div> <div class="slide-sub">Hoş geldiniz!</div> <div class="slide-content"> <div class="big-text">Bu slayt editörü ile kendi sunumlarınızı oluşturun.</div> <div class="phone-task-box">📂 "Dosya İçe Aktar" ile kendi HTML dosyanızı yükleyin.</div> </div> </div> <div class="slide-card" data-slide="1"> <div class="slide-title">📂 Dosya Yükle</div> <div class="slide-sub">Kendi slaytlarınızı getirin</div> <div class="slide-content"> <div class="big-text">Üst soldaki buton ile <span class="highlight">.html</span> dosyanızı seçin.</div> <div class="big-text">Tüm <code>.slide-card</code> slaytları otomatik aktarılır.</div> <div class="phone-task-box">📁 Her slayta MP3 de ekleyebilirsiniz.</div> </div> </div> <div class="slide-card" data-slide="2"> <div class="slide-title">🎤 MP3 Ses Ekle</div> <div class="slide-sub">Slaytlara seslendirme</div> <div class="slide-content"> <div class="big-text">Sağ alttaki <span class="highlight">mikrofon</span> butonu veya <kbd>M</kbd> tuşu ile paneli açın.</div> <div class="big-text">Her slayta ayrı MP3 dosyası yükleyin. Ses bitince otomatik geçer.</div> <div class="phone-task-box">🎧 Slayt geçişleri için <kbd>←</kbd> <kbd>→</kbd> tuşlarını kullanın.</div> </div> </div> </div> <!-- ----- Alt Kontroller ----- --> <div class="controls-bottom"> <button id="playPauseBtn" class="active" title="Oynat / Durdur"><i class="fas fa-pause"></i></button> <button id="fullscreenBtn" title="Tam Ekran"><i class="fas fa-expand"></i></button> <button id="mp3ToggleBtn" title="MP3 Yönetimi"><i class="fas fa-microphone"></i></button> </div> <!-- ----- MP3 Yönetim Paneli ----- --> <div class="mp3-manager" id="mp3Manager"> <div class="title"> <span><i class="fas fa-microphone"></i> Ses Yönetimi</span> <button class="close-btn" id="closeMp3Btn"><i class="fas fa-times"></i></button> </div> <div id="mp3List"> <!-- Dinamik olarak doldurulacak --> </div> <div style="font-size:0.7rem; color:#94a3b8; text-align:center; margin-top:4px;"> Her slayta MP3 dosyası yükleyin. Ses bitince geçiş otomatik olur. </div> </div> <!-- Hidden audio player --> <audio id="audioPlayer"></audio> <!-- Toast mesajı --> <div class="toast" id="toast"></div> </div> <!-- jQuery & Owl Carousel --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script> <script> (function() { 'use strict'; // ----- State ----- var slides = []; var currentIndex = 0; var totalSlides = 0; var isPlaying = true; var isAudioPlaying = false; var autoplayTimeout = 5000; var autoplayInterval = null; // DOM refs var sliderWrapper = document.getElementById('sliderWrapper'); var owlElement = $('#mainSlider'); var audioPlayer = document.getElementById('audioPlayer'); var playPauseBtn = document.getElementById('playPauseBtn'); var fullscreenBtn = document.getElementById('fullscreenBtn'); var mp3ToggleBtn = document.getElementById('mp3ToggleBtn'); var mp3Manager = document.getElementById('mp3Manager'); var closeMp3Btn = document.getElementById('closeMp3Btn'); var mp3ListEl = document.getElementById('mp3List'); var fileInput = document.getElementById('fileInput'); var slideCountBadge = document.getElementById('slideCountBadge'); var toastEl = document.getElementById('toast'); // ----- Owl Carousel Başlat ----- var owl = owlElement.owlCarousel({ loop: true, margin: 0, nav: true, navText: ['‹', '›'], dots: true, autoplay: true, autoplayTimeout: autoplayTimeout, autoplayHoverPause: true, responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } }, animateOut: 'fadeOut', animateIn: 'fadeIn', smartSpeed: 700, }); // ----- Slayt verilerini başlat ----- function initSlidesFromDOM() { var items = document.querySelectorAll('.slide-card'); totalSlides = items.length; slides = []; items.forEach(function(el, idx) { var html = el.innerHTML; slides.push({ index: idx, html: html, mp3DataUrl: null, mp3FileName: null }); }); updateBadge(); renderMp3List(); if (totalSlides > 0) { currentIndex = 0; loadAudioForCurrent(); } } // ----- Slaytları Güncelle (import sonrası) ----- function rebuildSlidesFromArray(newSlides) { // Owl'ı durdur ve temizle owl.trigger('stop.owl.autoplay'); // Mevcut .slide-card'ları kaldır var container = document.querySelector('.owl-carousel'); var oldCards = container.querySelectorAll('.slide-card'); oldCards.forEach(function(el) { el.remove(); }); // Yeni slaytları ekle newSlides.forEach(function(slideData, idx) { var div = document.createElement('div'); div.className = 'slide-card'; div.setAttribute('data-slide', idx); div.innerHTML = slideData.html; container.appendChild(div); }); // Slayt verilerini güncelle slides = []; var cards = document.querySelectorAll('.slide-card'); cards.forEach(function(el, idx) { slides.push({ index: idx, html: el.innerHTML, mp3DataUrl: null, mp3FileName: null }); }); totalSlides = slides.length; currentIndex = 0; // Owl'ı yeniden başlat owl.trigger('destroy.owl.carousel'); owl.owlCarousel({ loop: true, margin: 0, nav: true, navText: ['‹', '›'], dots: true, autoplay: true, autoplayTimeout: autoplayTimeout, autoplayHoverPause: true, responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } }, animateOut: 'fadeOut', animateIn: 'fadeIn', smartSpeed: 700, }); attachSlideChangeEvent(); updateBadge(); renderMp3List(); if (totalSlides > 0) { loadAudioForCurrent(); if (isPlaying) startAutoplay(); } updatePlayButton(); showToast('✅ ' + totalSlides + ' slayt başarıyla içe aktarıldı!'); } // ----- Slayt değişim olayı ----- function attachSlideChangeEvent() { owl.off('changed.owl.carousel'); owl.on('changed.owl.carousel', function(event) { var idx = event.item.index; if (idx !== currentIndex) { currentIndex = idx; loadAudioForCurrent(); if (isPlaying && slides[currentIndex] && slides[currentIndex].mp3DataUrl) { stopAutoplay(); playAudio(); } else { if (isPlaying) startAutoplay(); } renderMp3List(); } }); } attachSlideChangeEvent(); // ----- Badge güncelleme ----- function updateBadge() { slideCountBadge.textContent = totalSlides + ' slayt'; } // ----- MP3 Listesini render et ----- function renderMp3List() { var html = ''; slides.forEach(function(slide, idx) { var hasMp3 = slide.mp3DataUrl ? true : false; html += ` <div class="mp3-item" data-index="${idx}"> <span class="slide-label">${idx+1}.</span> <input type="file" accept="audio/*" class="mp3-file-input" data-index="${idx}" /> <span class="status ${hasMp3 ? '' : 'empty'}">${hasMp3 ? '✅' : '❌'}</span> ${hasMp3 ? `<span style="font-size:0.65rem; color:#4a5a72; max-width:60px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">${slide.mp3FileName || 'ses'}</span>` : ''} ${hasMp3 ? `<button class="remove-mp3" data-index="${idx}"><i class="fas fa-times"></i></button>` : ''} </div> `; }); mp3ListEl.innerHTML = html; // Event listeners document.querySelectorAll('.mp3-file-input').forEach(function(input) { input.addEventListener('change', function(e) { var idx = parseInt(this.dataset.index); handleMp3Upload(idx, this); }); }); document.querySelectorAll('.remove-mp3').forEach(function(btn) { btn.addEventListener('click', function(e) { var idx = parseInt(this.dataset.index); removeMp3(idx); }); }); } // ----- MP3 Yükleme ----- function handleMp3Upload(index, input) { var file = input.files[0]; if (!file) return; // Sadece ses dosyalarını kabul et if (!file.type.startsWith('audio/')) { showToast('⚠️ Lütfen geçerli bir ses dosyası seçin (MP3, WAV, vb.)'); input.value = ''; return; } var reader = new FileReader(); reader.onload = function(e) { slides[index].mp3DataUrl = e.target.result; slides[index].mp3FileName = file.name; renderMp3List(); // Eğer bu slayt görüntüleniyorsa ve oynatılıyorsa hemen yükle ve oynat if (index === currentIndex) { loadAudioForCurrent(); if (isPlaying) { playAudio(); } } showToast('✅ Ses yüklendi: ' + file.name); }; reader.onerror = function() { showToast('⚠️ Dosya okunamadı, lütfen tekrar deneyin.'); }; reader.readAsDataURL(file); } // ----- MP3 Kaldırma ----- function removeMp3(index) { slides[index].mp3DataUrl = null; slides[index].mp3FileName = null; if (index === currentIndex) { audioPlayer.pause(); isAudioPlaying = false; updatePlayButton(); if (isPlaying) startAutoplay(); } renderMp3List(); showToast('🗑️ Ses kaldırıldı.'); } // ----- Ses Kontrolleri (Geliştirilmiş) ----- function loadAudioForCurrent() { var slide = slides[currentIndex]; if (slide && slide.mp3DataUrl) { audioPlayer.src = slide.mp3DataUrl; audioPlayer.load(); // Ses yüklendiğinde otomatik oynatma için beklenebilir } else { audioPlayer.src = ''; audioPlayer.load(); } } function playAudio() { if (!slides[currentIndex] || !slides[currentIndex].mp3DataUrl) { isAudioPlaying = false; return; } // Eğer zaten çalıyorsa tekrar başlatma if (isAudioPlaying) return; audioPlayer.play().then(function() { isAudioPlaying = true; updatePlayButton(); owl.trigger('stop.owl.autoplay'); }).catch(function(err) { console.warn('Ses oynatılamadı:', err); isAudioPlaying = false; updatePlayButton(); if (isPlaying) startAutoplay(); }); } function pauseAudio() { audioPlayer.pause(); isAudioPlaying = false; updatePlayButton(); if (isPlaying) startAutoplay(); } // Ses bittiğinde otomatik geçiş audioPlayer.addEventListener('ended', function() { isAudioPlaying = false; updatePlayButton(); if (isPlaying) { goToNextSlide(); startAutoplay(); } }); // Ses yüklenemediğinde hata yönetimi audioPlayer.addEventListener('error', function(e) { console.warn('Ses hatası:', e); isAudioPlaying = false; updatePlayButton(); if (isPlaying) startAutoplay(); }); // ----- Autoplay ----- function startAutoplay() { stopAutoplay(); if (!isPlaying || totalSlides <= 1) return; autoplayInterval = setInterval(function() { if (isAudioPlaying) return; goToNextSlide(); }, autoplayTimeout); } function stopAutoplay() { if (autoplayInterval) { clearInterval(autoplayInterval); autoplayInterval = null; } } function goToNextSlide() { if (totalSlides === 0) return; var next = (currentIndex + 1) % totalSlides; owl.trigger('to.owl.carousel', [next, 300]); // currentIndex, changed olayında güncellenecek } // ----- Play / Pause ----- function togglePlay() { isPlaying = !isPlaying; updatePlayButton(); if (isPlaying) { if (slides[currentIndex] && slides[currentIndex].mp3DataUrl) { loadAudioForCurrent(); playAudio(); } else { startAutoplay(); } } else { stopAutoplay(); pauseAudio(); } } function updatePlayButton() { if (isPlaying) { playPauseBtn.innerHTML = '<i class="fas fa-pause"></i>'; playPauseBtn.classList.add('active'); } else { playPauseBtn.innerHTML = '<i class="fas fa-play"></i>'; playPauseBtn.classList.remove('active'); } } // ----- Tam Ekran ----- function toggleFullscreen() { if (!document.fullscreenElement) { document.documentElement.requestFullscreen().catch(function(err) { showToast('⚠️ Tam ekran açılamadı: ' + err.message); }); fullscreenBtn.innerHTML = '<i class="fas fa-compress"></i>'; } else { if (document.exitFullscreen) document.exitFullscreen(); fullscreenBtn.innerHTML = '<i class="fas fa-expand"></i>'; } } document.addEventListener('fullscreenchange', function() { if (!document.fullscreenElement) { fullscreenBtn.innerHTML = '<i class="fas fa-expand"></i>'; } else { fullscreenBtn.innerHTML = '<i class="fas fa-compress"></i>'; } }); // ----- MP3 Panel ----- function toggleMp3Panel() { mp3Manager.classList.toggle('open'); } // ----- Toast mesajı ----- function showToast(msg) { toastEl.textContent = msg; toastEl.classList.add('show'); clearTimeout(toastEl._timer); toastEl._timer = setTimeout(function() { toastEl.classList.remove('show'); }, 3000); } // ----- File Import (Geliştirilmiş) ----- fileInput.addEventListener('change', function(e) { if (!this.files || !this.files[0]) return; var file = this.files[0]; var reader = new FileReader(); reader.onload = function(e) { try { var content = e.target.result; var parser = new DOMParser(); var doc = parser.parseFromString(content, 'text/html'); var slideCards = doc.querySelectorAll('.slide-card'); // .owl-item içindeki .slide-card'ları da dene if (slideCards.length === 0) { var owlItems = doc.querySelectorAll('.owl-item'); if (owlItems.length > 0) { var cards = []; owlItems.forEach(function(item) { var card = item.querySelector('.slide-card'); if (card) cards.push(card); else cards.push(item); }); slideCards = cards; } } if (slideCards.length === 0) { showToast('⚠️ Dosyada .slide-card veya .owl-item içinde slayt bulunamadı!'); return; } var newSlides = []; slideCards.forEach(function(card, idx) { var html = card.innerHTML; if (card.classList.contains('owl-item')) { var innerCard = card.querySelector('.slide-card'); if (innerCard) html = innerCard.innerHTML; } newSlides.push({ html: html }); }); rebuildSlidesFromArray(newSlides); } catch (err) { showToast('⚠️ Dosya okunurken hata oluştu: ' + err.message); } }; reader.onerror = function() { showToast('⚠️ Dosya okunamadı, lütfen tekrar deneyin.'); }; reader.readAsText(file); this.value = ''; // Reset }); // ----- Event Listeners ----- playPauseBtn.addEventListener('click', togglePlay); fullscreenBtn.addEventListener('click', toggleFullscreen); mp3ToggleBtn.addEventListener('click', toggleMp3Panel); closeMp3Btn.addEventListener('click', function() { mp3Manager.classList.remove('open'); }); // Klavye kısayolları document.addEventListener('keydown', function(e) { if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; if (e.key === ' ' || e.key === 'Space') { e.preventDefault(); togglePlay(); } if (e.key === 'ArrowRight') { e.preventDefault(); if (isAudioPlaying) pauseAudio(); goToNextSlide(); } if (e.key === 'ArrowLeft') { e.preventDefault(); if (isAudioPlaying) pauseAudio(); var prev = (currentIndex - 1 + totalSlides) % totalSlides; owl.trigger('to.owl.carousel', [prev, 300]); // currentIndex, changed olayında güncellenecek } if (e.key === 'f' || e.key === 'F') { toggleFullscreen(); } if (e.key === 'm' || e.key === 'M') { toggleMp3Panel(); } }); // ----- Başlangıç ----- initSlidesFromDOM(); currentIndex = 0; loadAudioForCurrent(); startAutoplay(); updatePlayButton(); console.log('🎬 Dinamik Slider Builder + MP3 Yönetimi (Güncel) başlatıldı!'); console.log('📌 Klavye: Boşluk (play/pause), Ok tuşları (geçiş), F (tam ekran), M (MP3 paneli)'); console.log('📌 "Dosya İçe Aktar" ile kendi HTML dosyanızı yükleyin.'); console.log('📌 MP3 dosyaları yükleyip oynatabilirsiniz. Ses bitince otomatik geçer.'); console.log('⚠️ Yerel dosyalar için "Live Server" veya benzeri bir sunucu kullanmanız önerilir.'); // Hata yakalama ve kullanıcı bilgilendirme window.addEventListener('error', function(e) { console.error('Genel hata:', e); showToast('⚠️ Bir hata oluştu, konsola bakın.'); }); })(); </script> Assistant
I'll analyze the provided HTML and convert it into a React + Vite + Tailwind CSS application. Let me first explore the project structure.
Now I'll install the needed packages and set up the project. I'll use
embla-carousel-reactfor the carousel functionality since Owl Carousel is jQuery-based.Now let me update the index.html title and add Google Fonts:
Now let me update the CSS file to add global styles:
Now let me create the main slide data and types file:
Now let me create the default slides data:
Now let me create a Toast component:
Now let me create the MP3 Manager panel component:
Now let me create the SlideCard component:
Now let me create the main App component:
Let me fix the unused variable:
Now let's build and check for errors:
The build succeeded. Now let me also remove the unused
AnimationDirectiontype from types.ts and clean up the import in App.tsx:The build is clean. Here's a summary of everything that was built:
✅ Dinamik Slider Builder + MP3 Yönetimi — React Edition
The original vanilla HTML/JS/jQuery app has been fully converted into a React + Vite + Tailwind CSS application. Here's what was implemented:
📁 File Structure
File Purpose src/App.tsxMain app shell — all state, logic, and layout src/components/SlideCard.tsxRenders each slide's HTML content with fade-in animation src/components/Mp3Manager.tsxFloating MP3 management panel src/components/Toast.tsxToast notification component src/types.tsTypeScript types ( SlideData)src/defaultSlides.tsThe 3 default welcome slides src/index.cssGlobal styles + slide content CSS classes 🎯 Features Preserved (1:1)
- HTML file import — parse
.htmlfiles and extract.slide-cardelements - Slide navigation — prev/next arrows + clickable dot indicators (active dot expands to pill shape)
- Autoplay — 5 second interval, pauses while audio is playing
- Play/Pause toggle
- Fullscreen mode — controls fade out, reappear on mouse move
- MP3 per slide — upload, preview status, remove per slide
- Audio auto-advance — next slide triggers when audio ends
- Keyboard shortcuts —
Space,←,→,F,M - Shine bar animation at top of each slide
- Slide count badge and slide counter (top-right)
- Toast notifications for all user actions
- Keyboard hint bar at bottom-left
Files built:
index.html,src/index.css,src/types.ts,src/defaultSlides.ts,src/components/Toast.tsx,src/components/Mp3Manager.tsx,src/components/SlideCard.tsx,src/App.tsx- HTML file import — parse