Spaces:
Running
Running
🐳 14/04 - 06:12 - Implement a locked download system for every track.For EACH track:- Add a visible "Unlock to Download" button- Display price: Minimum $0.50 (user can pay more)Unlock flow:1. User cl
14f1f7e verified Download search.html from Onttraders/BeatFridge: direct link, hf CLI and curl.
- Browser
- Download file 16.3 kB
-
https://huggingface.co/spaces/Onttraders/BeatFridge/resolve/main/search.html
- Command line
-
hf download hf://spaces/Onttraders/BeatFridge/search.html
-
curl -L -o search.html https://huggingface.co/spaces/Onttraders/BeatFridge/resolve/main/search.html
16.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Search - BeatFridge</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/lucide@latest"></script> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet"> | |
| <link rel="stylesheet" href="responsive.css"> | |
| <style> | |
| * { font-family: 'Inter', sans-serif; } | |
| body { background-color: #0a0a0a; color: #ffffff; } | |
| ::-webkit-scrollbar { width: 8px; } | |
| ::-webkit-scrollbar-track { background: #0a0a0a; } | |
| ::-webkit-scrollbar-thumb { background: #2d2d2d; border-radius: 4px; } | |
| .glass { background: rgba(20,20,20,0.6); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.08); } | |
| .glass-panel { background: rgba(30,30,30,0.4); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.05); } | |
| .neon-text { background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; } | |
| .track-card { transition: all 0.3s cubic-bezier(0.4,0,0.2,1); } | |
| .track-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(0,212,255,0.15); } | |
| .play-btn-overlay { opacity: 0; transition: all 0.3s ease; } | |
| .track-card:hover .play-btn-overlay { opacity: 1; } | |
| .glow-cyan { box-shadow: 0 0 20px rgba(0,212,255,0.3); } | |
| .sticky-player { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; } | |
| .avatar-ring { box-shadow: 0 0 0 4px #0a0a0a, 0 0 0 6px rgba(0,212,255,0.5); } | |
| </style> | |
| </head> | |
| <body class="bg-black text-white overflow-x-hidden"> | |
| <!-- Top Navigation --> | |
| <nav class="fixed top-0 left-0 right-0 z-40 glass border-b border-white/5"> | |
| <div class="max-w-[1600px] mx-auto px-4 sm:px-6 h-14 flex items-center justify-between"> | |
| <div class="flex items-center gap-6"> | |
| <a href="index.html" class="flex items-center gap-2"> | |
| <div class="w-8 h-8 rounded-lg flex items-center justify-center bg-white/10 border border-white/20"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-5 h-5 text-white"><rect x="4" y="2" width="16" height="20" rx="2"/><line x1="4" y1="9" x2="20" y2="9"/><line x1="15" y1="5" x2="15" y2="7"/><line x1="15" y1="12" x2="15" y2="18"/></svg> | |
| </div> | |
| <span class="text-lg font-bold tracking-tight hidden sm:inline">BeatFridge</span> | |
| </a> | |
| <div class="hidden md:flex items-center gap-5 text-sm font-medium text-gray-400"> | |
| <a href="index.html" class="hover:text-cyan-400 transition">Home</a> | |
| <a href="search.html" class="text-cyan-400">Search</a> | |
| <a href="upload.html" data-nav-upload class="hover:text-cyan-400 transition flex items-center gap-1"><i data-lucide="upload-cloud" class="w-4 h-4"></i>Upload</a> | |
| <a href="library.html" class="hover:text-cyan-400 transition">Library</a> | |
| </div> | |
| </div> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-9 h-9 rounded-full bg-gradient-to-br from-cyan-400 to-purple-600 cursor-pointer hover:scale-105 transition avatar-ring overflow-hidden" onclick="BF.isLoggedIn() ? window.location.href='profile.html' : BF.showSignInModal()"> | |
| <img id="topNavAvatar" src="http://static.photos/people/200x200/42" alt="Profile" class="w-full h-full rounded-full object-cover"> | |
| </div> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Main Content --> | |
| <main class="max-w-[1600px] mx-auto pt-16 px-4 sm:px-6 pb-32 md:pb-24"> | |
| <!-- Search Header --> | |
| <div class="pt-6 pb-6"> | |
| <h1 class="text-2xl sm:text-3xl font-bold mb-4 neon-text">Search</h1> | |
| <div class="relative"> | |
| <input type="text" id="searchInput" placeholder="Search artists, tracks, genres..." | |
| class="w-full bg-white/5 border border-white/10 rounded-2xl px-5 py-4 pl-12 text-base focus:outline-none focus:border-cyan-500/50 focus:bg-white/10 transition text-white placeholder-gray-500" | |
| oninput="handleSearch(this.value)" autofocus> | |
| <i data-lucide="search" class="w-5 h-5 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400"></i> | |
| <button id="clearSearch" class="hidden absolute right-4 top-1/2 -translate-y-1/2 text-gray-400 hover:text-white transition" onclick="clearSearch()"> | |
| <i data-lucide="x" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Browse Genres (shown when no search) --> | |
| <div id="browseSection"> | |
| <h2 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-lucide="grid" class="w-5 h-5 text-cyan-400"></i> | |
| Browse by Genre | |
| </h2> | |
| <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3 mb-8" id="genreGrid"></div> | |
| <h2 class="text-lg font-semibold mb-4 flex items-center gap-2"> | |
| <i data-lucide="users" class="w-5 h-5 text-purple-400"></i> | |
| Popular Artists | |
| </h2> | |
| <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4" id="popularArtists"></div> | |
| </div> | |
| <!-- Search Results --> | |
| <div id="resultsSection" class="hidden"> | |
| <!-- Results Tabs --> | |
| <div class="flex items-center gap-4 border-b border-white/10 mb-6"> | |
| <button class="px-4 py-3 text-sm font-medium text-white border-b-2 border-cyan-400" onclick="setResultTab('all')" id="tabAll">All</button> | |
| <button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="setResultTab('artists')" id="tabArtists">Artists</button> | |
| <button class="px-4 py-3 text-sm font-medium text-gray-400 hover:text-white transition" onclick="setResultTab('tracks')" id="tabTracks">Tracks</button> | |
| </div> | |
| <!-- Artists Results --> | |
| <div id="artistResults" class="mb-8"> | |
| <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Artists</h3> | |
| <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4" id="artistResultGrid"></div> | |
| </div> | |
| <!-- Tracks Results --> | |
| <div id="trackResults"> | |
| <h3 class="text-sm font-semibold text-gray-400 uppercase tracking-wider mb-4">Tracks</h3> | |
| <div class="space-y-2" id="trackResultList"></div> | |
| </div> | |
| <!-- No Results --> | |
| <div id="noResults" class="hidden text-center py-16"> | |
| <div class="w-16 h-16 rounded-full bg-white/5 flex items-center justify-center mx-auto mb-4"> | |
| <i data-lucide="search-x" class="w-8 h-8 text-gray-500"></i> | |
| </div> | |
| <h3 class="text-xl font-semibold text-gray-300 mb-2">No results found</h3> | |
| <p class="text-gray-500">Try different keywords or browse genres</p> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Sticky Bottom Player --> | |
| <div class="sticky-player glass border-t border-white/10 px-4 py-3"> | |
| <div class="max-w-[1600px] mx-auto flex items-center gap-4"> | |
| <div class="flex items-center gap-3 w-48 sm:w-64 flex-shrink-0"> | |
| <div class="w-12 h-12 sm:w-14 sm:h-14 rounded-lg overflow-hidden flex-shrink-0"> | |
| <img id="playerArt" src="http://static.photos/technology/200x200/5" class="w-full h-full object-cover"> | |
| </div> | |
| <div class="min-w-0 flex-1"> | |
| <p id="playerTitle" class="text-sm font-medium text-white truncate">Midnight Synthesis</p> | |
| <p id="playerArtist" class="text-xs text-gray-400 truncate">Aurora Void</p> | |
| </div> | |
| </div> | |
| <div class="flex-1 flex items-center justify-center max-w-2xl mx-auto"> | |
| <button class="w-10 h-10 rounded-full bg-white text-black flex items-center justify-center hover:scale-105 transition" onclick="BF.togglePlay()"> | |
| <i data-lucide="play" class="w-5 h-5 fill-current ml-0.5" id="playIcon"></i> | |
| </button> | |
| </div> | |
| <div class="hidden sm:flex items-center gap-3 w-48 sm:w-64 justify-end"> | |
| <div class="flex items-center gap-2"><i data-lucide="volume-2" class="w-5 h-5 text-gray-400"></i><div class="w-20 h-1 bg-white/10 rounded-full overflow-hidden"><div class="h-full bg-cyan-400 w-[70%] rounded-full"></div></div></div> | |
| </div> | |
| </div> | |
| </div> | |
| <script src="app.js"></script> | |
| <script> | |
| BF.init('search'); | |
| let currentResultTab = 'all'; | |
| // Genre grid | |
| const genreColors = { cyan: 'from-cyan-900/40 to-cyan-800/20 border-cyan-500/20 hover:border-cyan-500/40', purple: 'from-purple-900/40 to-purple-800/20 border-purple-500/20 hover:border-purple-500/40', orange: 'from-orange-900/40 to-orange-800/20 border-orange-500/20 hover:border-orange-500/40', pink: 'from-pink-900/40 to-pink-800/20 border-pink-500/20 hover:border-pink-500/40', green: 'from-green-900/40 to-green-800/20 border-green-500/20 hover:border-green-500/40', red: 'from-red-900/40 to-red-800/20 border-red-500/20 hover:border-red-500/40' }; | |
| const genreIcons = { cyan: 'waves', purple: 'cloud', orange: 'flame', pink: 'zap', green: 'leaf', red: 'activity' }; | |
| document.getElementById('genreGrid').innerHTML = BF.getGenres().map(g => ` | |
| <a href="#" class="glass-panel rounded-xl p-5 text-center cursor-pointer transition bg-gradient-to-br ${genreColors[g.color]} border" onclick="document.getElementById('searchInput').value='${g.name}'; handleSearch('${g.name}'); return false;"> | |
| <div class="w-10 h-10 rounded-full bg-${g.color}-500/20 flex items-center justify-center mx-auto mb-3"><i data-lucide="${genreIcons[g.color]}" class="w-5 h-5 text-${g.color}-400"></i></div> | |
| <p class="font-medium text-white">${g.name}</p> | |
| </a> | |
| `).join(''); | |
| // Popular artists | |
| document.getElementById('popularArtists').innerHTML = BF.getArtists().map(a => ` | |
| <a href="artist.html" class="glass-panel rounded-xl p-4 text-center group cursor-pointer hover:bg-white/5 transition"> | |
| <div class="w-20 h-20 rounded-full overflow-hidden mx-auto mb-3 ${a.verified ? 'avatar-ring' : ''}"> | |
| <img src="${a.image}" class="w-full h-full object-cover"> | |
| </div> | |
| <h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition">${a.name}</h3> | |
| <p class="text-xs text-gray-500">${a.followers} followers</p> | |
| </a> | |
| `).join(''); | |
| // Search handler | |
| let searchTimeout; | |
| function handleSearch(query) { | |
| clearTimeout(searchTimeout); | |
| const clearBtn = document.getElementById('clearSearch'); | |
| clearBtn.classList.toggle('hidden', !query); | |
| if (!query.trim()) { | |
| document.getElementById('browseSection').classList.remove('hidden'); | |
| document.getElementById('resultsSection').classList.add('hidden'); | |
| return; | |
| } | |
| searchTimeout = setTimeout(() => { | |
| const artists = BF.searchArtists(query); | |
| const tracks = BF.searchTracks(query); | |
| showResults(artists, tracks, query); | |
| }, 200); | |
| } | |
| function showResults(artists, tracks, query) { | |
| document.getElementById('browseSection').classList.add('hidden'); | |
| document.getElementById('resultsSection').classList.remove('hidden'); | |
| const hasResults = artists.length || tracks.length; | |
| document.getElementById('noResults').classList.toggle('hidden', hasResults); | |
| document.getElementById('artistResults').classList.toggle('hidden', !artists.length || currentResultTab === 'tracks'); | |
| document.getElementById('trackResults').classList.toggle('hidden', !tracks.length || currentResultTab === 'artists'); | |
| // Artists | |
| document.getElementById('artistResultGrid').innerHTML = artists.slice(0, 10).map(a => ` | |
| <a href="artist.html" class="glass-panel rounded-xl p-4 text-center group cursor-pointer hover:bg-white/5 transition"> | |
| <div class="w-20 h-20 rounded-full overflow-hidden mx-auto mb-3 ${a.verified ? 'avatar-ring' : ''}"> | |
| <img src="${a.image}" class="w-full h-full object-cover"> | |
| </div> | |
| <h3 class="text-sm font-semibold text-white truncate group-hover:text-cyan-400 transition">${a.name}</h3> | |
| <p class="text-xs text-gray-500">${a.followers} followers</p> | |
| </a> | |
| `).join(''); | |
| // Tracks | |
| document.getElementById('trackResultList').innerHTML = tracks.slice(0, 20).map(track => ` | |
| <div class="flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition cursor-pointer group" onclick="BF.playTrack(${JSON.stringify(track).replace(/"/g, '"')})"> | |
| <div class="w-12 h-12 rounded-lg overflow-hidden flex-shrink-0 relative"> | |
| <img src="${track.image}" class="w-full h-full object-cover"> | |
| <div class="absolute inset-0 bg-black/50 flex items-center justify-center opacity-0 group-hover:opacity-100 transition"> | |
| <i data-lucide="play" class="w-4 h-4 text-cyan-400 fill-current"></i> | |
| </div> | |
| </div> | |
| <div class="flex-1 min-w-0"> | |
| <h4 class="text-sm font-medium text-white truncate group-hover:text-cyan-400 transition">${track.title}</h4> | |
| <p class="text-xs text-gray-500 truncate">${track.artist} • ${track.plays} plays</p> | |
| </div> | |
| <span class="flex-shrink-0">${BF.renderDL(track.id, track.title, track.artist)}</span> | |
| <span class="text-xs text-gray-600 hidden sm:inline">${track.duration}</span> | |
| </div> | |
| `).join(''); | |
| lucide.createIcons(); | |
| } | |
| function setResultTab(tab) { | |
| currentResultTab = tab; | |
| document.querySelectorAll('[id^="tab"]').forEach(t => { t.classList.remove('text-white', 'border-b-2', 'border-cyan-400'); t.classList.add('text-gray-400'); }); | |
| document.getElementById('tab' + tab.charAt(0).toUpperCase() + tab.slice(1)).classList.add('text-white', 'border-b-2', 'border-cyan-400'); | |
| document.getElementById('tab' + tab.charAt(0).toUpperCase() + tab.slice(1)).classList.remove('text-gray-400'); | |
| const q = document.getElementById('searchInput').value; | |
| if (q) { | |
| const a = BF.searchArtists(q); | |
| const t = BF.searchTracks(q); | |
| showResults(a, t, q); | |
| } | |
| } | |
| function clearSearch() { | |
| document.getElementById('searchInput').value = ''; | |
| document.getElementById('browseSection').classList.remove('hidden'); | |
| document.getElementById('resultsSection').classList.add('hidden'); | |
| document.getElementById('clearSearch').classList.add('hidden'); | |
| document.getElementById('searchInput').focus(); | |
| } | |
| // Check for genre param in URL | |
| const params = new URLSearchParams(window.location.search); | |
| const genreParam = params.get('genre'); | |
| if (genreParam) { | |
| document.getElementById('searchInput').value = genreParam; | |
| handleSearch(genreParam); | |
| } | |
| lucide.createIcons(); | |
| </script> | |
| </body> | |
| </html> |