1/** 2 * Episode List Pagination with Smooth Scrolling 3 * Handles pagination clicks and scrolls back to the episode list 4 */ 5 6document.addEventListener('DOMContentLoaded', function() { 7 // Find all pagination links with scroll targets 8 const paginationLinks = document.querySelectorAll('a[data-scroll-target]'); 9 10 paginationLinks.forEach(link => { 11 link.addEventListener('click', function(e) { 12 const scrollTarget = this.getAttribute('data-scroll-target'); 13 const targetUrl = this.getAttribute('href'); 14 15 // Store the scroll target in sessionStorage for the next page 16 if (scrollTarget) { 17 sessionStorage.setItem('episodeListScrollTarget', scrollTarget); 18 } 19 20 // Let the normal navigation happen 21 // The scroll will be handled on the new page 22 }); 23 }); 24 25 // Check if we need to scroll to a target after page load 26 const scrollTarget = sessionStorage.getItem('episodeListScrollTarget'); 27 if (scrollTarget) { 28 // Clear the stored target 29 sessionStorage.removeItem('episodeListScrollTarget'); 30 31 // Wait a bit for the page to fully render 32 setTimeout(() => { 33 const targetElement = document.getElementById(scrollTarget); 34 if (targetElement) { 35 // Scroll to the target element 36 targetElement.scrollIntoView({ 37 behavior: 'smooth', 38 block: 'start' 39 }); 40 41 // Update URL with hash for better UX (optional) 42 if (history.replaceState) { 43 const newUrl = window.location.href.split('#')[0] + '#' + scrollTarget; 44 history.replaceState(null, '', newUrl); 45 } 46 } 47 }, 100); 48 } 49});
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.