1export function initTopAnimes() { 2 const root = document.querySelector('[data-slider="top-animes"]'); 3 if (!root) return; 4 5 const mainImg = root.querySelector('#topanime-main-img'); 6 const title = root.querySelector('#topanime-title'); 7 const genres = root.querySelector('#topanime-genres'); 8 const visits = root.querySelector('#topanime-visits'); 9 const rating = root.querySelector('#topanime-rating'); // ð NUEVO 10 const link = root.querySelector('#topanime-link'); 11 12 const thumbs = [...root.querySelectorAll('.topanime-thumb')]; 13 if (!thumbs.length) return; 14 15 const select = (el, doScroll = true) => { 16 thumbs.forEach(b => b.classList.remove('active')); 17 el.classList.add('active'); 18 19 mainImg.src = el.dataset.img || ''; 20 mainImg.alt = el.dataset.title || ''; 21 title.textContent = el.dataset.title || ''; 22 genres.textContent = el.dataset.genres || ''; 23 visits.textContent = el.dataset.visits || ''; 24 link.href = el.dataset.link || '#'; 25 26 const avg = el.dataset.rating || '0'; 27 const votes = parseInt(el.dataset.votes || '0', 10); 28 29 if (rating) { 30 const avgNum = parseFloat(avg) || 0; 31 32 rating.innerHTML = 33 votes > 0 34 ? `â ${avgNum.toFixed(1)}/5.0 <span class="muted">(Votos ${votes})</span>` 35 : `â 0.0/5.0 <span class="muted">(Sin votos)</span>`; 36 } 37 38 // ð´ SOLO SCROLL SI SE PERMITE 39 if (doScroll) { 40 el.scrollIntoView({ 41 behavior: 'smooth', 42 block: 'nearest', 43 inline: 'nearest' 44 }); 45 } 46 }; 47 48 select(thumbs[0], false); 49 thumbs.forEach(b => b.addEventListener('click', () => select(b))); 50}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.