// filtros con botones function initFilters() { filterBtns.forEach(btn => { btn.addEventListener('click', () => { const filterValue = btn.getAttribute('data-filter'); currentFilter = filterValue; // actualizar active class filterBtns.forEach(b => b.classList.remove('active')); btn.classList.add('active'); render(); }); }); }
// fondo de imagen con gradiente + ícono representativo const bgGradient = `linear-gradient(135deg, ${album.coverColor}dd, ${album.coverColor}aa)`; // lista de tracks (mostrar máximo 6 primeros) const trackListItems = album.tracks.slice(0, 8).map(track => `<li><i class="fas fa-music" style="font-size: 0.6rem; margin-right: 4px;"></i> ${escapeHtml(track)}</li>`).join(''); const moreTracks = album.tracks.length > 8 ? `<li style="background: none;">+${album.tracks.length - 8} más</li>` : ''; enjambre discografia
return filtered; }
// construcción de cards let html = ''; for (let album of filteredData) { // tipo legible let typeLabel = ''; let typeIcon = ''; if (album.type === 'estudio') { typeLabel = 'Álbum de estudio'; typeIcon = '🎙️'; } else if (album.type === 'ep') { typeLabel = 'EP / Extended Play'; typeIcon = '💿'; } else if (album.type === 'live') { typeLabel = 'En vivo / Concierto'; typeIcon = '🎤'; } // filtros con botones function initFilters() { filterBtns
// Helper: normalizar texto function normalizeText(txt) { return txt.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } { const filterValue = btn.getAttribute('data-filter')