Spaces:
Running
Running
Download index.html from atlkaran635/code: direct link, hf CLI and curl.
- Browser
- Download file 32.2 kB
-
https://huggingface.co/spaces/atlkaran635/code/resolve/main/index.html
- Command line
-
hf download hf://spaces/atlkaran635/code/index.html
-
curl -L -o index.html https://huggingface.co/spaces/atlkaran635/code/resolve/main/index.html
32.2 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>FocusTube - Distraction-Free Study Player</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: { | |
| light: '#FF0000', | |
| dark: '#FF3333' | |
| }, | |
| dark: { | |
| 900: '#0F0F0F', | |
| 800: '#181818', | |
| 700: '#202020', | |
| 600: '#282828' | |
| } | |
| }, | |
| animation: { | |
| 'fade-in': 'fadeIn 0.3s ease-out forwards', | |
| 'slide-up': 'slideUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards', | |
| 'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite' | |
| }, | |
| keyframes: { | |
| fadeIn: { | |
| '0%': { opacity: '0' }, | |
| '100%': { opacity: '1' } | |
| }, | |
| slideUp: { | |
| '0%': { transform: 'translateY(20px)', opacity: '0' }, | |
| '100%': { transform: 'translateY(0)', opacity: '1' } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap'); | |
| body { | |
| font-family: 'Roboto', sans-serif; | |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| background-color: #FFFFFF; | |
| } | |
| body.dark { | |
| background-color: #0F0F0F; | |
| color: #FFFFFF; | |
| } | |
| /* Custom scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| height: 8px; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background-color: rgba(255, 255, 255, 0.2); | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background-color: transparent; | |
| } | |
| .dark ::-webkit-scrollbar-thumb { | |
| background-color: rgba(255, 255, 255, 0.1); | |
| } | |
| /* Video player container aspect ratio */ | |
| .video-container { | |
| position: relative; | |
| padding-bottom: 56.25%; /* 16:9 aspect ratio */ | |
| height: 0; | |
| overflow: hidden; | |
| } | |
| .video-container iframe { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| border: none; | |
| } | |
| /* Focus mode overlay */ | |
| .focus-overlay { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| right: 0; | |
| bottom: 0; | |
| background-color: rgba(0, 0, 0, 0.9); | |
| z-index: 100; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| opacity: 0; | |
| pointer-events: none; | |
| transition: opacity 0.3s ease; | |
| } | |
| .focus-overlay.active { | |
| opacity: 1; | |
| pointer-events: all; | |
| } | |
| /* Timer animation */ | |
| @keyframes timerPulse { | |
| 0% { transform: scale(1); } | |
| 50% { transform: scale(1.05); } | |
| 100% { transform: scale(1); } | |
| } | |
| .timer-pulse { | |
| animation: timerPulse 2s infinite; | |
| } | |
| /* Smooth transitions */ | |
| .transition-slow { | |
| transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1); | |
| } | |
| </style> | |
| </head> | |
| <body class="dark:bg-dark-900 dark:text-white transition-colors duration-300"> | |
| <div class="container mx-auto px-4 py-6 max-w-7xl"> | |
| <!-- Header --> | |
| <header class="flex justify-between items-center mb-6 animate-fade-in"> | |
| <div class="flex items-center"> | |
| <div class="bg-primary-light dark:bg-primary-dark h-10 w-10 rounded-lg flex items-center justify-center mr-3"> | |
| <i class="fas fa-headphones text-white text-lg"></i> | |
| </div> | |
| <h1 class="text-2xl font-bold">Focus<span class="text-primary-light dark:text-primary-dark">Tube</span></h1> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button id="focus-mode-btn" class="flex items-center space-x-2 bg-gray-100 dark:bg-dark-700 hover:bg-gray-200 dark:hover:bg-dark-600 px-4 py-2 rounded-lg transition-slow"> | |
| <i class="fas fa-bullseye text-primary-light dark:text-primary-dark"></i> | |
| <span class="hidden md:inline">Focus Mode</span> | |
| </button> | |
| <button id="dark-mode-btn" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-dark-700 transition-slow"> | |
| <i class="fas fa-moon dark:hidden"></i> | |
| <i class="fas fa-sun hidden dark:block"></i> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Main Content --> | |
| <div class="grid grid-cols-1 lg:grid-cols-4 gap-6"> | |
| <!-- Video Player Section --> | |
| <div class="lg:col-span-3"> | |
| <!-- Video Player --> | |
| <div class="bg-black rounded-xl overflow-hidden shadow-lg mb-6 animate-slide-up"> | |
| <div class="video-container"> | |
| <iframe id="youtube-player" src="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
| </div> | |
| </div> | |
| <!-- Video Info --> | |
| <div class="bg-white dark:bg-dark-800 rounded-xl shadow-lg p-6 mb-6 animate-slide-up"> | |
| <h2 id="video-title" class="text-xl font-bold mb-2">No video selected</h2> | |
| <div class="flex items-center justify-between mb-4"> | |
| <div class="flex items-center space-x-4"> | |
| <div class="h-10 w-10 rounded-full bg-gray-300 dark:bg-dark-700 flex items-center justify-center"> | |
| <i class="fas fa-user text-gray-500 dark:text-gray-400"></i> | |
| </div> | |
| <div> | |
| <p id="channel-name" class="font-medium">Channel Name</p> | |
| <p class="text-sm text-gray-500 dark:text-gray-400">0 subscribers</p> | |
| </div> | |
| </div> | |
| <button id="like-btn" class="flex items-center space-x-2 bg-gray-100 dark:bg-dark-700 hover:bg-gray-200 dark:hover:bg-dark-600 px-4 py-2 rounded-lg transition-slow"> | |
| <i class="far fa-thumbs-up"></i> | |
| <span>Like</span> | |
| </button> | |
| </div> | |
| <div class="bg-gray-100 dark:bg-dark-700 rounded-lg p-4"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <p class="text-sm font-medium">Description</p> | |
| <button id="show-more-btn" class="text-primary-light dark:text-primary-dark text-sm font-medium">Show more</button> | |
| </div> | |
| <p id="video-description" class="text-sm line-clamp-3">Select a video from the sidebar to view its description here.</p> | |
| </div> | |
| </div> | |
| <!-- Focus Timer (Hidden by default) --> | |
| <div id="focus-timer-container" class="bg-white dark:bg-dark-800 rounded-xl shadow-lg p-6 mb-6 hidden animate-slide-up"> | |
| <h3 class="text-lg font-bold mb-4">Focus Timer</h3> | |
| <div class="flex flex-col items-center"> | |
| <div id="timer-display" class="text-5xl font-bold mb-6">25:00</div> | |
| <div class="flex space-x-4"> | |
| <button id="start-timer-btn" class="bg-primary-light dark:bg-primary-dark text-white px-6 py-3 rounded-lg font-medium hover:bg-opacity-90 transition-slow"> | |
| Start Focus Session | |
| </button> | |
| <button id="stop-timer-btn" class="bg-gray-200 dark:bg-dark-700 px-6 py-3 rounded-lg font-medium hover:bg-gray-300 dark:hover:bg-dark-600 transition-slow"> | |
| Stop | |
| </button> | |
| </div> | |
| <div class="mt-6 w-full max-w-md"> | |
| <label for="timer-duration" class="block text-sm font-medium mb-2">Duration (minutes)</label> | |
| <input type="range" id="timer-duration" min="5" max="120" value="25" class="w-full h-2 bg-gray-200 dark:bg-dark-600 rounded-lg appearance-none cursor-pointer"> | |
| <div class="flex justify-between text-sm text-gray-500 dark:text-gray-400 mt-1"> | |
| <span>5 min</span> | |
| <span id="current-duration">25 min</span> | |
| <span>120 min</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Sidebar --> | |
| <div class="lg:col-span-1"> | |
| <!-- Search --> | |
| <div class="bg-white dark:bg-dark-800 rounded-xl shadow-lg p-4 mb-6 animate-slide-up"> | |
| <div class="relative"> | |
| <input type="text" id="video-search" placeholder="Search study videos..." class="w-full bg-gray-100 dark:bg-dark-700 border-none rounded-lg pl-10 pr-4 py-3 focus:ring-2 focus:ring-primary-light dark:focus:ring-primary-dark"> | |
| <i class="fas fa-search absolute left-3 top-3.5 text-gray-500 dark:text-gray-400"></i> | |
| </div> | |
| </div> | |
| <!-- Playlists --> | |
| <div class="bg-white dark:bg-dark-800 rounded-xl shadow-lg p-4 mb-6 animate-slide-up"> | |
| <h3 class="font-bold mb-4">Study Playlists</h3> | |
| <div class="space-y-3"> | |
| <button class="playlist-btn w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-700 transition-slow" data-playlist="PLWKjhJtqVAbnZtkAI3BqcYxKnfRCNHgAk"> | |
| <i class="fas fa-music mr-2 text-primary-light dark:text-primary-dark"></i> | |
| Focus Music | |
| </button> | |
| <button class="playlist-btn w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-700 transition-slow" data-playlist="PL6K53MPRflr9kDvdX6h1vR7qPYyKvU5l1"> | |
| <i class="fas fa-graduation-cap mr-2 text-primary-light dark:text-primary-dark"></i> | |
| Study With Me | |
| </button> | |
| <button class="playlist-btn w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-700 transition-slow" data-playlist="PL6K53MPRflr8nwQ5U3RgLmW7sQjvQ6q9y"> | |
| <i class="fas fa-water mr-2 text-primary-light dark:text-primary-dark"></i> | |
| Rain Sounds | |
| </button> | |
| <button class="playlist-btn w-full text-left px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-700 transition-slow" data-playlist="PL6K53MPRflr8nwQ5U3RgLmW7sQjvQ6q9y"> | |
| <i class="fas fa-leaf mr-2 text-primary-light dark:text-primary-dark"></i> | |
| Nature Sounds | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Video List --> | |
| <div class="bg-white dark:bg-dark-800 rounded-xl shadow-lg p-4 animate-slide-up"> | |
| <h3 class="font-bold mb-4">Recommended Videos</h3> | |
| <div id="video-list" class="space-y-3 max-h-[500px] overflow-y-auto pr-2"> | |
| <!-- Videos will be loaded here --> | |
| <div class="text-center py-8 text-gray-500 dark:text-gray-400"> | |
| <i class="fas fa-video text-3xl mb-3"></i> | |
| <p>Search for videos to get started</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Focus Mode Overlay --> | |
| <div id="focus-overlay" class="focus-overlay"> | |
| <div class="text-center"> | |
| <div id="focus-timer" class="text-7xl font-bold mb-8">25:00</div> | |
| <p class="text-xl mb-6">Stay focused! The video will resume when timer ends.</p> | |
| <button id="exit-focus-btn" class="bg-primary-light dark:bg-primary-dark text-white px-8 py-3 rounded-lg font-medium hover:bg-opacity-90 transition-slow"> | |
| Exit Focus Mode | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Scripts --> | |
| <script> | |
| // DOM Elements | |
| const youtubePlayer = document.getElementById('youtube-player'); | |
| const videoTitle = document.getElementById('video-title'); | |
| const channelName = document.getElementById('channel-name'); | |
| const videoDescription = document.getElementById('video-description'); | |
| const showMoreBtn = document.getElementById('show-more-btn'); | |
| const likeBtn = document.getElementById('like-btn'); | |
| const videoSearch = document.getElementById('video-search'); | |
| const videoList = document.getElementById('video-list'); | |
| const playlistBtns = document.querySelectorAll('.playlist-btn'); | |
| const darkModeBtn = document.getElementById('dark-mode-btn'); | |
| const focusModeBtn = document.getElementById('focus-mode-btn'); | |
| const focusOverlay = document.getElementById('focus-overlay'); | |
| const focusTimer = document.getElementById('focus-timer'); | |
| const exitFocusBtn = document.getElementById('exit-focus-btn'); | |
| const timerDisplay = document.getElementById('timer-display'); | |
| const startTimerBtn = document.getElementById('start-timer-btn'); | |
| const stopTimerBtn = document.getElementById('stop-timer-btn'); | |
| const timerDuration = document.getElementById('timer-duration'); | |
| const currentDuration = document.getElementById('current-duration'); | |
| const focusTimerContainer = document.getElementById('focus-timer-container'); | |
| // State | |
| let currentVideoId = ''; | |
| let isDescriptionExpanded = false; | |
| let isDarkMode = localStorage.getItem('darkMode') === 'true'; | |
| let isFocusModeActive = false; | |
| let timerInterval; | |
| let timerSecondsLeft = 25 * 60; | |
| let isTimerRunning = false; | |
| // Initialize | |
| function init() { | |
| // Set dark mode if enabled | |
| if (isDarkMode) { | |
| document.documentElement.classList.add('dark'); | |
| } | |
| // Load default playlist | |
| loadPlaylist('PL6K53MPRflr9kDvdX6h1vR7qPYyKvU5l1'); | |
| // Show focus timer container | |
| focusTimerContainer.classList.remove('hidden'); | |
| // Set up event listeners | |
| setupEventListeners(); | |
| } | |
| // Set up event listeners | |
| function setupEventListeners() { | |
| // Dark mode toggle | |
| darkModeBtn.addEventListener('click', toggleDarkMode); | |
| // Focus mode toggle | |
| focusModeBtn.addEventListener('click', toggleFocusMode); | |
| // Exit focus mode | |
| exitFocusBtn.addEventListener('click', exitFocusMode); | |
| // Show more/less description | |
| showMoreBtn.addEventListener('click', toggleDescription); | |
| // Like button | |
| likeBtn.addEventListener('click', () => { | |
| likeBtn.innerHTML = '<i class="fas fa-thumbs-up"></i> Liked'; | |
| likeBtn.classList.add('text-primary-light', 'dark:text-primary-dark'); | |
| showToast('Video liked'); | |
| }); | |
| // Video search | |
| videoSearch.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') { | |
| searchVideos(videoSearch.value); | |
| } | |
| }); | |
| // Playlist buttons | |
| playlistBtns.forEach(btn => { | |
| btn.addEventListener('click', () => { | |
| const playlistId = btn.getAttribute('data-playlist'); | |
| loadPlaylist(playlistId); | |
| }); | |
| }); | |
| // Timer controls | |
| startTimerBtn.addEventListener('click', startTimer); | |
| stopTimerBtn.addEventListener('click', stopTimer); | |
| // Timer duration slider | |
| timerDuration.addEventListener('input', updateTimerDuration); | |
| // Hide focus timer when video is playing | |
| youtubePlayer.addEventListener('play', () => { | |
| if (isFocusModeActive) { | |
| focusOverlay.classList.add('active'); | |
| } | |
| }); | |
| } | |
| // Toggle dark mode | |
| function toggleDarkMode() { | |
| isDarkMode = !isDarkMode; | |
| localStorage.setItem('darkMode', isDarkMode); | |
| if (isDarkMode) { | |
| document.documentElement.classList.add('dark'); | |
| } else { | |
| document.documentElement.classList.remove('dark'); | |
| } | |
| showToast(`Dark mode ${isDarkMode ? 'enabled' : 'disabled'}`); | |
| } | |
| // Toggle focus mode | |
| function toggleFocusMode() { | |
| isFocusModeActive = !isFocusModeActive; | |
| if (isFocusModeActive) { | |
| focusModeBtn.innerHTML = '<i class="fas fa-bullseye text-primary-light dark:text-primary-dark"></i><span class="hidden md:inline">Focus Active</span>'; | |
| focusModeBtn.classList.add('bg-primary-light', 'dark:bg-primary-dark', 'bg-opacity-10'); | |
| if (!youtubePlayer.paused) { | |
| focusOverlay.classList.add('active'); | |
| } | |
| showToast('Focus mode activated'); | |
| } else { | |
| focusModeBtn.innerHTML = '<i class="fas fa-bullseye text-primary-light dark:text-primary-dark"></i><span class="hidden md:inline">Focus Mode</span>'; | |
| focusModeBtn.classList.remove('bg-primary-light', 'dark:bg-primary-dark', 'bg-opacity-10'); | |
| focusOverlay.classList.remove('active'); | |
| showToast('Focus mode deactivated'); | |
| } | |
| } | |
| // Exit focus mode | |
| function exitFocusMode() { | |
| toggleFocusMode(); | |
| youtubePlayer.play(); | |
| } | |
| // Toggle video description | |
| function toggleDescription() { | |
| isDescriptionExpanded = !isDescriptionExpanded; | |
| if (isDescriptionExpanded) { | |
| videoDescription.classList.remove('line-clamp-3'); | |
| showMoreBtn.textContent = 'Show less'; | |
| } else { | |
| videoDescription.classList.add('line-clamp-3'); | |
| showMoreBtn.textContent = 'Show more'; | |
| } | |
| } | |
| // Load YouTube playlist | |
| function loadPlaylist(playlistId) { | |
| // In a real app, we would use YouTube API to fetch playlist videos | |
| // For demo, we'll use mock data | |
| const mockPlaylists = { | |
| 'PL6K53MPRflr9kDvdX6h1vR7qPYyKvU5l1': [ | |
| { | |
| id: 'jfKfPfyJRdk', | |
| title: 'lofi hip hop radio - beats to relax/study to', | |
| channel: 'Lofi Girl', | |
| description: 'A popular lofi hip hop livestream for studying and relaxing.', | |
| thumbnail: 'https://i.ytimg.com/vi/jfKfPfyJRdk/mqdefault.jpg' | |
| }, | |
| { | |
| id: '5qap5aO4i9A', | |
| title: '24/7 lofi hip hop radio - beats to study/relax to', | |
| channel: 'Chillhop Music', | |
| description: 'Non-stop lofi beats for your study sessions.', | |
| thumbnail: 'https://i.ytimg.com/vi/5qap5aO4i9A/mqdefault.jpg' | |
| }, | |
| { | |
| id: 'DWcJFNfaw9c', | |
| title: 'Jazz for Study, Work ☕ Relaxing Jazz Music & Cozy Coffee Shop Ambience', | |
| channel: 'Coffee Relaxing Jazz', | |
| description: 'Smooth jazz music perfect for studying and working.', | |
| thumbnail: 'https://i.ytimg.com/vi/DWcJFNfaw9c/mqdefault.jpg' | |
| }, | |
| { | |
| id: 'rUxyKA_-grg', | |
| title: 'Deep Focus Music To Improve Concentration - 12 Hours of Ambient Study Music', | |
| channel: 'Quiet Quest - Study Music', | |
| description: '12 hours of ambient study music to help you focus.', | |
| thumbnail: 'https://i.ytimg.com/vi/rUxyKA_-grg/mqdefault.jpg' | |
| }, | |
| { | |
| id: '4xDzrJKXOOY', | |
| title: 'Rain Sounds For Sleeping - 99% Instantly Fall Asleep With Rain And Thunder Sound', | |
| channel: 'Nature Sounds TV', | |
| description: 'Relaxing rain sounds for deep sleep and study.', | |
| thumbnail: 'https://i.ytimg.com/vi/4xDzrJKXOOY/mqdefault.jpg' | |
| } | |
| ], | |
| 'PLWKjhJtqVAbnZtkAI3BqcYxKnfRCNHgAk': [ | |
| { | |
| id: 'F5mRW7m7SlY', | |
| title: 'Classical Music for Studying & Brain Power', | |
| channel: 'HALIDONMUSIC', | |
| description: 'The best classical music for studying and concentration.', | |
| thumbnail: 'https://i.ytimg.com/vi/F5mRW7m7SlY/mqdefault.jpg' | |
| }, | |
| { | |
| id: 'pLJJP4LqIF4', | |
| title: 'Bach Study Music', | |
| channel: 'Classical Music', | |
| description: 'Bach compositions perfect for studying.', | |
| thumbnail: 'https://i.ytimg.com/vi/pLJJP4LqIF4/mqdefault.jpg' | |
| } | |
| ] | |
| }; | |
| const videos = mockPlaylists[playlistId] || mockPlaylists['PL6K53MPRflr9kDvdX6h1vR7qPYyKvU5l1']; | |
| displayVideos(videos); | |
| // Load first video by default | |
| if (videos.length > 0) { | |
| loadVideo(videos[0].id, videos[0].title, videos[0].channel, videos[0].description); | |
| } | |
| } | |
| // Search videos (mock implementation) | |
| function searchVideos(query) { | |
| if (!query.trim()) return; | |
| // In a real app, we would use YouTube API to search videos | |
| // For demo, we'll filter our mock data | |
| const mockVideos = [ | |
| { | |
| id: 'jfKfPfyJRdk', | |
| title: 'lofi hip hop radio - beats to relax/study to', | |
| channel: 'Lofi Girl', | |
| description: 'A popular lofi hip hop livestream for studying and relaxing.', | |
| thumbnail: 'https://i.ytimg.com/vi/jfKfPfyJRdk/mqdefault.jpg' | |
| }, | |
| { | |
| id: '5qap5aO4i9A', | |
| title: '24/7 lofi hip hop radio - beats to study/relax to', | |
| channel: 'Chillhop Music', | |
| description: 'Non-stop lofi beats for your study sessions.', | |
| thumbnail: 'https://i.ytimg.com/vi/5qap5aO4i9A/mqdefault.jpg' | |
| }, | |
| { | |
| id: 'DWcJFNfaw9c', | |
| title: 'Jazz for Study, Work ☕ Relaxing Jazz Music & Cozy Coffee Shop Ambience', | |
| channel: 'Coffee Relaxing Jazz', | |
| description: 'Smooth jazz music perfect for studying and working.', | |
| thumbnail: 'https://i.ytimg.com/vi/DWcJFNfaw9c/mqdefault.jpg' | |
| } | |
| ]; | |
| const filteredVideos = mockVideos.filter(video => | |
| video.title.toLowerCase().includes(query.toLowerCase()) || | |
| video.channel.toLowerCase().includes(query.toLowerCase()) | |
| ); | |
| displayVideos(filteredVideos.length > 0 ? filteredVideos : mockVideos); | |
| showToast(`Found ${filteredVideos.length} videos`); | |
| } | |
| // Display videos in sidebar | |
| function displayVideos(videos) { | |
| videoList.innerHTML = ''; | |
| if (videos.length === 0) { | |
| videoList.innerHTML = ` | |
| <div class="text-center py-8 text-gray-500 dark:text-gray-400"> | |
| <i class="fas fa-exclamation-circle text-3xl mb-3"></i> | |
| <p>No videos found</p> | |
| </div> | |
| `; | |
| return; | |
| } | |
| videos.forEach(video => { | |
| const videoElement = document.createElement('div'); | |
| videoElement.className = 'flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-700 cursor-pointer transition-slow'; | |
| videoElement.innerHTML = ` | |
| <img src="${video.thumbnail}" alt="${video.title}" class="w-16 h-12 rounded-md object-cover"> | |
| <div class="flex-1 min-w-0"> | |
| <p class="text-sm font-medium truncate">${video.title}</p> | |
| <p class="text-xs text-gray-500 dark:text-gray-400 truncate">${video.channel}</p> | |
| </div> | |
| `; | |
| videoElement.addEventListener('click', () => { | |
| loadVideo(video.id, video.title, video.channel, video.description); | |
| }); | |
| videoList.appendChild(videoElement); | |
| }); | |
| } | |
| // Load video into player | |
| function loadVideo(videoId, title, channel, description) { | |
| currentVideoId = videoId; | |
| youtubePlayer.src = `https://www.youtube.com/embed/${videoId}?autoplay=1&rel=0&modestbranding=1`; | |
| videoTitle.textContent = title; | |
| channelName.textContent = channel; | |
| videoDescription.textContent = description; | |
| videoDescription.classList.add('line-clamp-3'); | |
| isDescriptionExpanded = false; | |
| showMoreBtn.textContent = 'Show more'; | |
| // Reset like button | |
| likeBtn.innerHTML = '<i class="far fa-thumbs-up"></i> Like'; | |
| likeBtn.classList.remove('text-primary-light', 'dark:text-primary-dark'); | |
| showToast('Video loaded'); | |
| } | |
| // Timer functions | |
| function startTimer() { | |
| if (isTimerRunning) return; | |
| isTimerRunning = true; | |
| startTimerBtn.textContent = 'Pause'; | |
| startTimerBtn.classList.remove('bg-primary-light', 'dark:bg-primary-dark'); | |
| startTimerBtn.classList.add('bg-yellow-500'); | |
| timerInterval = setInterval(() => { | |
| timerSecondsLeft--; | |
| updateTimerDisplay(); | |
| if (timerSecondsLeft <= 0) { | |
| stopTimer(); | |
| showToast('Focus session completed!'); | |
| if (isFocusModeActive) { | |
| focusOverlay.classList.remove('active'); | |
| youtubePlayer.pause(); | |
| } | |
| } | |
| }, 1000); | |
| if (isFocusModeActive) { | |
| focusOverlay.classList.add('active'); | |
| } | |
| } | |
| function stopTimer() { | |
| clearInterval(timerInterval); | |
| isTimerRunning = false; | |
| startTimerBtn.textContent = 'Start Focus Session'; | |
| startTimerBtn.classList.add('bg-primary-light', 'dark:bg-primary-dark'); | |
| startTimerBtn.classList.remove('bg-yellow-500'); | |
| // Reset timer to selected duration | |
| timerSecondsLeft = parseInt(timerDuration.value) * 60; | |
| updateTimerDisplay(); | |
| if (isFocusModeActive) { | |
| focusOverlay.classList.remove('active'); | |
| } | |
| } | |
| function updateTimerDuration() { | |
| const minutes = timerDuration.value; | |
| currentDuration.textContent = `${minutes} min`; | |
| if (!isTimerRunning) { | |
| timerSecondsLeft = minutes * 60; | |
| updateTimerDisplay(); | |
| } | |
| } | |
| function updateTimerDisplay() { | |
| const minutes = Math.floor(timerSecondsLeft / 60); | |
| const seconds = timerSecondsLeft % 60; | |
| const displayTime = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; | |
| timerDisplay.textContent = displayTime; | |
| focusTimer.textContent = displayTime; | |
| // Add pulse animation when under 1 minute | |
| if (timerSecondsLeft < 60) { | |
| focusTimer.classList.add('timer-pulse', 'text-red-400'); | |
| } else { | |
| focusTimer.classList.remove('timer-pulse', 'text-red-400'); | |
| } | |
| } | |
| // Show toast notification | |
| function showToast(message) { | |
| const toast = document.createElement('div'); | |
| toast.className = 'fixed bottom-6 left-1/2 transform -translate-x-1/2 bg-gray-800 dark:bg-gray-600 text-white px-4 py-2 rounded-lg text-sm animate-slide-up'; | |
| toast.textContent = message; | |
| document.body.appendChild(toast); | |
| setTimeout(() => { | |
| toast.classList.remove('animate-slide-up'); | |
| toast.classList.add('opacity-0', 'transition-opacity', 'duration-300'); | |
| setTimeout(() => { | |
| toast.remove(); | |
| }, 300); | |
| }, 3000); | |
| } | |
| // Initialize the app | |
| init(); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=atlkaran635/code" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |