/*
This file is part of Freedom Loader.
Copyright (C) 2025 MasterAcnolo
Freedom Loader is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.
Freedom Loader is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
Channel : ${data.channel || "Unknown"}
`; const listDiv = document.getElementById("playlistVideos"); data.videos.forEach(v => { const durationStr = `${Math.floor(v.duration/60)}m ${(v.duration%60).toString().padStart(2,"0")}s`; const videoUrl = v.id ? `https://www.youtube.com/watch?v=${v.id}` : v.url; listDiv.innerHTML += ` `; }); listDiv.addEventListener("click", (e) => { if (e.target.classList.contains("copy-btn")) { const btn = e.target; if (btn.disabled) return; btn.disabled = true; const url = btn.dataset.url; navigator.clipboard.writeText(url) .then(() => { const original = btn.textContent; // fade out + shrink btn.style.opacity = 0; btn.style.transform = "scale(0.7)"; setTimeout(() => { btn.textContent = "✅"; btn.style.opacity = 1; btn.style.transform = "scale(1)"; setTimeout(() => { btn.style.opacity = 0; btn.style.transform = "scale(0.7)"; setTimeout(() => { btn.textContent = original; btn.style.opacity = 1; btn.style.transform = "scale(1)"; btn.disabled = false; // réactive le bouton }, 300); }, 1000); }, 300); }) .catch(() => { const original = btn.textContent; btn.textContent = "❌"; setTimeout(() => { btn.textContent = original; btn.disabled = false; }, 1500); }); } }); infoDiv.classList.add("visible"); return; } else { infoDiv.classList.remove("playlist-mode"); } // Vidéo normale const durationStr = `${Math.floor(data.duration/60)}m ${(data.duration%60) .toString() .padStart(2,"0")}s`; const sizeStr = formatSize(data.filesize_approx); const readableDate = formatDate(data.upload_date); const categories = data.categories?.join(", ") || "Non spécifiées"; infoDiv.innerHTML = `