1const customSwiperTrending = () => { 2 const swiperTrending = new Swiper('.slide-trending', { 3 autoplay: { 4 delay: 3500, 5 disableOnInteraction: false, 6 }, 7 effect: 'fade', 8 fadeEffect: { crossFade: true }, 9 slidesPerView: 1, 10 pagination: { 11 el: '.swiper-pagination', 12 clickable: true, 13 }, 14 }); 15}; 16 17const cleanCategories = (element) => { 18 if (element) { 19 const regex = /<a[^>]*\/(para-empresas|para-voce)[^>]*>.*?<\/a>/g; 20 21 element.innerHTML = element.innerHTML.replace(regex, ''); 22 element.innerHTML = element.innerHTML.replace(/,\s*,/g, ''); 23 } 24 25 return element; 26}; 27 28const callback = (mutationsList, observer) => { 29 const ulElement = document.querySelector( 30 '#trending-posts .wpp-ajax ul.wpp-list' 31 ); 32 const liElements = ulElement ? ulElement.querySelectorAll('li') : null; 33 const sliderList = document.getElementById('slider-list'); 34 35 if (liElements && liElements.length > 0) { 36 liElements.forEach(function (li, index) { 37 cleanCategories(li); 38 39 const position = index + 1; 40 const pElement = li.querySelector('.trend-badge p'); 41 42 if (pElement) { 43 const spanElement = document.createElement('span'); 44 spanElement.textContent = `${position}º`; 45 46 pElement.innerHTML = `${spanElement.outerHTML} MAIS ACESSADO`; 47 } 48 49 sliderList.appendChild(li); 50 }); 51 } 52 53 containerWpp.remove(); 54 55 customSwiperTrending(); 56}; 57 58const containerWpp = document.querySelector('#trending-posts'); 59if (containerWpp) { 60 const observer = new MutationObserver(callback); 61 observer.observe(containerWpp, { childList: true, subtree: true }); 62}
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.