Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +6 -4
- index.html +464 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: purple
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: khan
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: purple
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,464 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Melody Player</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Poppins', sans-serif;
|
| 14 |
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
| 15 |
+
color: white;
|
| 16 |
+
min-height: 100vh;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.progress-container {
|
| 20 |
+
height: 6px;
|
| 21 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 22 |
+
border-radius: 3px;
|
| 23 |
+
cursor: pointer;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
.progress-bar {
|
| 27 |
+
height: 100%;
|
| 28 |
+
background: linear-gradient(90deg, #00dbde 0%, #fc00ff 100%);
|
| 29 |
+
border-radius: 3px;
|
| 30 |
+
transition: width 0.1s linear;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.album-art {
|
| 34 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
|
| 35 |
+
transition: all 0.3s ease;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.album-art:hover {
|
| 39 |
+
transform: scale(1.03);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.song-item:hover {
|
| 43 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.active-song {
|
| 47 |
+
background: linear-gradient(90deg, rgba(0, 219, 222, 0.2) 0%, rgba(252, 0, 255, 0.2) 100%);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.volume-slider {
|
| 51 |
+
-webkit-appearance: none;
|
| 52 |
+
width: 100%;
|
| 53 |
+
height: 4px;
|
| 54 |
+
background: rgba(255, 255, 255, 0.2);
|
| 55 |
+
border-radius: 2px;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.volume-slider::-webkit-slider-thumb {
|
| 59 |
+
-webkit-appearance: none;
|
| 60 |
+
width: 12px;
|
| 61 |
+
height: 12px;
|
| 62 |
+
background: white;
|
| 63 |
+
border-radius: 50%;
|
| 64 |
+
cursor: pointer;
|
| 65 |
+
}
|
| 66 |
+
</style>
|
| 67 |
+
</head>
|
| 68 |
+
<body class="text-white">
|
| 69 |
+
<div class="container mx-auto px-4 py-6 max-w-md">
|
| 70 |
+
<!-- Header -->
|
| 71 |
+
<header class="flex justify-between items-center mb-8">
|
| 72 |
+
<button class="text-white text-xl">
|
| 73 |
+
<i class="fas fa-bars"></i>
|
| 74 |
+
</button>
|
| 75 |
+
<h1 class="text-xl font-bold">Melody Player</h1>
|
| 76 |
+
<button class="text-white text-xl">
|
| 77 |
+
<i class="fas fa-search"></i>
|
| 78 |
+
</button>
|
| 79 |
+
</header>
|
| 80 |
+
|
| 81 |
+
<!-- Now Playing -->
|
| 82 |
+
<div class="text-center mb-10">
|
| 83 |
+
<div class="album-art w-64 h-64 mx-auto rounded-xl overflow-hidden mb-6">
|
| 84 |
+
<img id="album-art" src="https://source.unsplash.com/random/300x300/?music" alt="Album Art" class="w-full h-full object-cover">
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<div class="mb-2">
|
| 88 |
+
<h2 id="song-title" class="text-xl font-bold">Song Title</h2>
|
| 89 |
+
<p id="song-artist" class="text-gray-300">Artist Name</p>
|
| 90 |
+
</div>
|
| 91 |
+
|
| 92 |
+
<div class="progress-container mx-auto w-full max-w-xs mb-4">
|
| 93 |
+
<div id="progress-bar" class="progress-bar w-0"></div>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div class="flex justify-between text-sm text-gray-400 mb-8 px-2">
|
| 97 |
+
<span id="current-time">0:00</span>
|
| 98 |
+
<span id="duration">3:45</span>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div class="flex justify-center items-center space-x-8">
|
| 102 |
+
<button id="shuffle-btn" class="text-gray-400 hover:text-white text-xl">
|
| 103 |
+
<i class="fas fa-random"></i>
|
| 104 |
+
</button>
|
| 105 |
+
<button id="prev-btn" class="text-white text-3xl">
|
| 106 |
+
<i class="fas fa-step-backward"></i>
|
| 107 |
+
</button>
|
| 108 |
+
<button id="play-btn" class="bg-gradient-to-r from-cyan-500 to-purple-500 w-16 h-16 rounded-full flex items-center justify-center text-white text-2xl">
|
| 109 |
+
<i class="fas fa-play"></i>
|
| 110 |
+
</button>
|
| 111 |
+
<button id="next-btn" class="text-white text-3xl">
|
| 112 |
+
<i class="fas fa-step-forward"></i>
|
| 113 |
+
</button>
|
| 114 |
+
<button id="repeat-btn" class="text-gray-400 hover:text-white text-xl">
|
| 115 |
+
<i class="fas fa-redo"></i>
|
| 116 |
+
</button>
|
| 117 |
+
</div>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<!-- Playlist -->
|
| 121 |
+
<div class="mb-20">
|
| 122 |
+
<div class="flex justify-between items-center mb-4">
|
| 123 |
+
<h3 class="font-medium">Playlist</h3>
|
| 124 |
+
<button id="playlist-menu" class="text-gray-400">
|
| 125 |
+
<i class="fas fa-ellipsis-h"></i>
|
| 126 |
+
</button>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div id="playlist" class="space-y-2 max-h-64 overflow-y-auto">
|
| 130 |
+
<!-- Songs will be added here by JavaScript -->
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<!-- Bottom Navigation -->
|
| 135 |
+
<nav class="fixed bottom-0 left-0 right-0 bg-gray-900 bg-opacity-80 backdrop-filter backdrop-blur-lg py-3 px-6">
|
| 136 |
+
<div class="flex justify-between items-center">
|
| 137 |
+
<div class="flex items-center space-x-3 w-1/3">
|
| 138 |
+
<img id="mini-album-art" src="https://source.unsplash.com/random/50x50/?music" alt="Album Art" class="w-10 h-10 rounded">
|
| 139 |
+
<div class="truncate">
|
| 140 |
+
<p id="mini-song-title" class="text-sm font-medium truncate">Song Title</p>
|
| 141 |
+
<p id="mini-song-artist" class="text-xs text-gray-400 truncate">Artist</p>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<div class="flex items-center space-x-4">
|
| 146 |
+
<button id="mini-play-btn" class="text-white">
|
| 147 |
+
<i class="fas fa-play"></i>
|
| 148 |
+
</button>
|
| 149 |
+
<button class="text-white">
|
| 150 |
+
<i class="fas fa-forward"></i>
|
| 151 |
+
</button>
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<div class="flex items-center space-x-2 w-1/3 justify-end">
|
| 155 |
+
<i class="fas fa-volume-down text-gray-400"></i>
|
| 156 |
+
<input id="volume-slider" type="range" class="volume-slider w-20" min="0" max="100" value="80">
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</nav>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<script>
|
| 163 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 164 |
+
// Sample playlist data
|
| 165 |
+
const playlist = [
|
| 166 |
+
{
|
| 167 |
+
title: "Blinding Lights",
|
| 168 |
+
artist: "The Weeknd",
|
| 169 |
+
duration: "3:20",
|
| 170 |
+
cover: "https://source.unsplash.com/random/300x300/?weeknd"
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
title: "Save Your Tears",
|
| 174 |
+
artist: "The Weeknd",
|
| 175 |
+
duration: "3:35",
|
| 176 |
+
cover: "https://source.unsplash.com/random/300x300/?tears"
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
title: "Levitating",
|
| 180 |
+
artist: "Dua Lipa",
|
| 181 |
+
duration: "3:23",
|
| 182 |
+
cover: "https://source.unsplash.com/random/300x300/?dua"
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
title: "Stay",
|
| 186 |
+
artist: "The Kid LAROI, Justin Bieber",
|
| 187 |
+
duration: "2:21",
|
| 188 |
+
cover: "https://source.unsplash.com/random/300x300/?kidlaroi"
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
title: "Good 4 U",
|
| 192 |
+
artist: "Olivia Rodrigo",
|
| 193 |
+
duration: "2:58",
|
| 194 |
+
cover: "https://source.unsplash.com/random/300x300/?olivia"
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
title: "Montero",
|
| 198 |
+
artist: "Lil Nas X",
|
| 199 |
+
duration: "2:17",
|
| 200 |
+
cover: "https://source.unsplash.com/random/300x300/?montero"
|
| 201 |
+
}
|
| 202 |
+
];
|
| 203 |
+
|
| 204 |
+
// DOM elements
|
| 205 |
+
const playBtn = document.getElementById('play-btn');
|
| 206 |
+
const miniPlayBtn = document.getElementById('mini-play-btn');
|
| 207 |
+
const prevBtn = document.getElementById('prev-btn');
|
| 208 |
+
const nextBtn = document.getElementById('next-btn');
|
| 209 |
+
const shuffleBtn = document.getElementById('shuffle-btn');
|
| 210 |
+
const repeatBtn = document.getElementById('repeat-btn');
|
| 211 |
+
const progressBar = document.getElementById('progress-bar');
|
| 212 |
+
const progressContainer = document.querySelector('.progress-container');
|
| 213 |
+
const currentTimeEl = document.getElementById('current-time');
|
| 214 |
+
const durationEl = document.getElementById('duration');
|
| 215 |
+
const songTitleEl = document.getElementById('song-title');
|
| 216 |
+
const songArtistEl = document.getElementById('song-artist');
|
| 217 |
+
const albumArtEl = document.getElementById('album-art');
|
| 218 |
+
const miniSongTitleEl = document.getElementById('mini-song-title');
|
| 219 |
+
const miniSongArtistEl = document.getElementById('mini-song-artist');
|
| 220 |
+
const miniAlbumArtEl = document.getElementById('mini-album-art');
|
| 221 |
+
const playlistEl = document.getElementById('playlist');
|
| 222 |
+
const volumeSlider = document.getElementById('volume-slider');
|
| 223 |
+
|
| 224 |
+
// Player state
|
| 225 |
+
let currentSongIndex = 0;
|
| 226 |
+
let isPlaying = false;
|
| 227 |
+
let isShuffled = false;
|
| 228 |
+
let isRepeated = false;
|
| 229 |
+
let currentTime = 0;
|
| 230 |
+
let duration = 0;
|
| 231 |
+
let progressInterval;
|
| 232 |
+
|
| 233 |
+
// Initialize player
|
| 234 |
+
function initPlayer() {
|
| 235 |
+
loadSong(currentSongIndex);
|
| 236 |
+
renderPlaylist();
|
| 237 |
+
|
| 238 |
+
// Event listeners
|
| 239 |
+
playBtn.addEventListener('click', togglePlay);
|
| 240 |
+
miniPlayBtn.addEventListener('click', togglePlay);
|
| 241 |
+
prevBtn.addEventListener('click', prevSong);
|
| 242 |
+
nextBtn.addEventListener('click', nextSong);
|
| 243 |
+
shuffleBtn.addEventListener('click', toggleShuffle);
|
| 244 |
+
repeatBtn.addEventListener('click', toggleRepeat);
|
| 245 |
+
progressContainer.addEventListener('click', setProgress);
|
| 246 |
+
volumeSlider.addEventListener('input', setVolume);
|
| 247 |
+
|
| 248 |
+
// Simulate audio element (in a real app, this would be an actual audio element)
|
| 249 |
+
setInterval(updateProgress, 1000);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// Load song
|
| 253 |
+
function loadSong(index) {
|
| 254 |
+
const song = playlist[index];
|
| 255 |
+
|
| 256 |
+
songTitleEl.textContent = song.title;
|
| 257 |
+
songArtistEl.textContent = song.artist;
|
| 258 |
+
durationEl.textContent = song.duration;
|
| 259 |
+
albumArtEl.src = song.cover;
|
| 260 |
+
|
| 261 |
+
miniSongTitleEl.textContent = song.title;
|
| 262 |
+
miniSongArtistEl.textContent = song.artist;
|
| 263 |
+
miniAlbumArtEl.src = song.cover;
|
| 264 |
+
|
| 265 |
+
// Reset progress
|
| 266 |
+
currentTime = 0;
|
| 267 |
+
updateProgressBar();
|
| 268 |
+
|
| 269 |
+
// Highlight active song in playlist
|
| 270 |
+
const songItems = document.querySelectorAll('.song-item');
|
| 271 |
+
songItems.forEach(item => item.classList.remove('active-song'));
|
| 272 |
+
if (songItems[index]) {
|
| 273 |
+
songItems[index].classList.add('active-song');
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
// Toggle play/pause
|
| 278 |
+
function togglePlay() {
|
| 279 |
+
isPlaying = !isPlaying;
|
| 280 |
+
|
| 281 |
+
if (isPlaying) {
|
| 282 |
+
playBtn.innerHTML = '<i class="fas fa-pause"></i>';
|
| 283 |
+
miniPlayBtn.innerHTML = '<i class="fas fa-pause"></i>';
|
| 284 |
+
// In a real app: audio.play();
|
| 285 |
+
} else {
|
| 286 |
+
playBtn.innerHTML = '<i class="fas fa-play"></i>';
|
| 287 |
+
miniPlayBtn.innerHTML = '<i class="fas fa-play"></i>';
|
| 288 |
+
// In a real app: audio.pause();
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
// Previous song
|
| 293 |
+
function prevSong() {
|
| 294 |
+
currentSongIndex--;
|
| 295 |
+
if (currentSongIndex < 0) {
|
| 296 |
+
currentSongIndex = playlist.length - 1;
|
| 297 |
+
}
|
| 298 |
+
loadSong(currentSongIndex);
|
| 299 |
+
if (isPlaying) {
|
| 300 |
+
// In a real app: audio.play();
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
// Next song
|
| 305 |
+
function nextSong() {
|
| 306 |
+
currentSongIndex++;
|
| 307 |
+
if (currentSongIndex > playlist.length - 1) {
|
| 308 |
+
currentSongIndex = 0;
|
| 309 |
+
}
|
| 310 |
+
loadSong(currentSongIndex);
|
| 311 |
+
if (isPlaying) {
|
| 312 |
+
// In a real app: audio.play();
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
// Toggle shuffle
|
| 317 |
+
function toggleShuffle() {
|
| 318 |
+
isShuffled = !isShuffled;
|
| 319 |
+
shuffleBtn.classList.toggle('text-white');
|
| 320 |
+
shuffleBtn.classList.toggle('text-gray-400');
|
| 321 |
+
|
| 322 |
+
if (isShuffled) {
|
| 323 |
+
// Shuffle playlist
|
| 324 |
+
shufflePlaylist();
|
| 325 |
+
} else {
|
| 326 |
+
// Restore original order
|
| 327 |
+
renderPlaylist();
|
| 328 |
+
}
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
// Toggle repeat
|
| 332 |
+
function toggleRepeat() {
|
| 333 |
+
isRepeated = !isRepeated;
|
| 334 |
+
repeatBtn.classList.toggle('text-white');
|
| 335 |
+
repeatBtn.classList.toggle('text-gray-400');
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
// Update progress bar
|
| 339 |
+
function updateProgress() {
|
| 340 |
+
if (!isPlaying) return;
|
| 341 |
+
|
| 342 |
+
// Simulate progress (in a real app, this would come from audio.currentTime)
|
| 343 |
+
currentTime += 1;
|
| 344 |
+
|
| 345 |
+
// If song ended
|
| 346 |
+
if (currentTime >= convertTimeToSeconds(durationEl.textContent)) {
|
| 347 |
+
if (isRepeated) {
|
| 348 |
+
currentTime = 0;
|
| 349 |
+
} else {
|
| 350 |
+
nextSong();
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
updateProgressBar();
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
function updateProgressBar() {
|
| 358 |
+
const durationSeconds = convertTimeToSeconds(durationEl.textContent);
|
| 359 |
+
const progressPercent = (currentTime / durationSeconds) * 100;
|
| 360 |
+
progressBar.style.width = `${progressPercent}%`;
|
| 361 |
+
|
| 362 |
+
// Update current time display
|
| 363 |
+
currentTimeEl.textContent = convertSecondsToTime(currentTime);
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
// Set progress on click
|
| 367 |
+
function setProgress(e) {
|
| 368 |
+
const width = this.clientWidth;
|
| 369 |
+
const clickX = e.offsetX;
|
| 370 |
+
const durationSeconds = convertTimeToSeconds(durationEl.textContent);
|
| 371 |
+
|
| 372 |
+
currentTime = (clickX / width) * durationSeconds;
|
| 373 |
+
// In a real app: audio.currentTime = currentTime;
|
| 374 |
+
updateProgressBar();
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
// Set volume
|
| 378 |
+
function setVolume() {
|
| 379 |
+
const volume = this.value / 100;
|
| 380 |
+
// In a real app: audio.volume = volume;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
// Render playlist
|
| 384 |
+
function renderPlaylist() {
|
| 385 |
+
playlistEl.innerHTML = '';
|
| 386 |
+
|
| 387 |
+
playlist.forEach((song, index) => {
|
| 388 |
+
const songItem = document.createElement('div');
|
| 389 |
+
songItem.className = `song-item flex items-center p-3 rounded-lg cursor-pointer ${index === currentSongIndex ? 'active-song' : ''}`;
|
| 390 |
+
songItem.innerHTML = `
|
| 391 |
+
<img src="${song.cover}" alt="${song.title}" class="w-12 h-12 rounded mr-3">
|
| 392 |
+
<div class="flex-grow">
|
| 393 |
+
<h4 class="font-medium">${song.title}</h4>
|
| 394 |
+
<p class="text-sm text-gray-400">${song.artist}</p>
|
| 395 |
+
</div>
|
| 396 |
+
<span class="text-gray-400 text-sm">${song.duration}</span>
|
| 397 |
+
`;
|
| 398 |
+
|
| 399 |
+
songItem.addEventListener('click', () => {
|
| 400 |
+
currentSongIndex = index;
|
| 401 |
+
loadSong(currentSongIndex);
|
| 402 |
+
if (!isPlaying) {
|
| 403 |
+
togglePlay();
|
| 404 |
+
}
|
| 405 |
+
});
|
| 406 |
+
|
| 407 |
+
playlistEl.appendChild(songItem);
|
| 408 |
+
});
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// Shuffle playlist
|
| 412 |
+
function shufflePlaylist() {
|
| 413 |
+
const shuffledPlaylist = [...playlist];
|
| 414 |
+
for (let i = shuffledPlaylist.length - 1; i > 0; i--) {
|
| 415 |
+
const j = Math.floor(Math.random() * (i + 1));
|
| 416 |
+
[shuffledPlaylist[i], shuffledPlaylist[j]] = [shuffledPlaylist[j], shuffledPlaylist[i]];
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
playlistEl.innerHTML = '';
|
| 420 |
+
|
| 421 |
+
shuffledPlaylist.forEach((song, index) => {
|
| 422 |
+
const songItem = document.createElement('div');
|
| 423 |
+
songItem.className = `song-item flex items-center p-3 rounded-lg cursor-pointer`;
|
| 424 |
+
songItem.innerHTML = `
|
| 425 |
+
<img src="${song.cover}" alt="${song.title}" class="w-12 h-12 rounded mr-3">
|
| 426 |
+
<div class="flex-grow">
|
| 427 |
+
<h4 class="font-medium">${song.title}</h4>
|
| 428 |
+
<p class="text-sm text-gray-400">${song.artist}</p>
|
| 429 |
+
</div>
|
| 430 |
+
<span class="text-gray-400 text-sm">${song.duration}</span>
|
| 431 |
+
`;
|
| 432 |
+
|
| 433 |
+
songItem.addEventListener('click', () => {
|
| 434 |
+
// Find the original index of the song
|
| 435 |
+
const originalIndex = playlist.findIndex(s => s.title === song.title);
|
| 436 |
+
currentSongIndex = originalIndex;
|
| 437 |
+
loadSong(currentSongIndex);
|
| 438 |
+
if (!isPlaying) {
|
| 439 |
+
togglePlay();
|
| 440 |
+
}
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
playlistEl.appendChild(songItem);
|
| 444 |
+
});
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
// Helper functions
|
| 448 |
+
function convertTimeToSeconds(timeStr) {
|
| 449 |
+
const [minutes, seconds] = timeStr.split(':').map(Number);
|
| 450 |
+
return minutes * 60 + seconds;
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
function convertSecondsToTime(seconds) {
|
| 454 |
+
const mins = Math.floor(seconds / 60);
|
| 455 |
+
const secs = Math.floor(seconds % 60);
|
| 456 |
+
return `${mins}:${secs < 10 ? '0' : ''}${secs}`;
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
// Initialize the player
|
| 460 |
+
initPlayer();
|
| 461 |
+
});
|
| 462 |
+
</script>
|
| 463 |
+
<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=Khansahabddu/khan" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 464 |
+
</html>
|