1jQuery(function($) { 2 const ajaxFilter = jQuery( '#ajax-filter .dd' ) 3 const siteContent = jQuery( '#site-content' ) 4 const gridWrap = jQuery( '#grid-wrap' ) 5 const loading = jQuery( '#loading' ) 6 const paginationLinks = jQuery( '.paginated-links' ) 7 const dropDowns = jQuery( '.dd' ) 8 9 // Use event delegation on the body to catch clicks on dynamically loaded links 10 $(document).on('click', '#pagination a.page-numbers', function(e) { 11 e.preventDefault(); // Stop the default link behavior 12 13 14 loading.removeClass('hidden') 15 siteContent.addClass( 'hidden' ) 16 paginationLinks.addClass('hidden') 17 18 19 // const ajaxFilter = jQuery( '#ajax-filter .dd input:checked' ) 20 // const cat = ajaxFilter.data('value'); 21 // const type = ajaxFilter.data('type'); 22 pagination = jQuery('#pagination'); 23 // const cat = 'blogs'; 24 // const type = 'post'; 25 26 27 let values_type = jQuery('#dropdownHover input:checked').map(function() { 28 return $(this).val().replace(/\s+/g, ''); 29 }).get(); 30 31 if(values_type.length === 0) { 32 values_type = []; 33 } 34 35 let values_cat = jQuery('#dropdownHover_2 input:checked').map(function() { 36 return $(this).val().replace(/\s+/g, ''); 37 }).get(); 38 39 if(values_cat.length === 0) { 40 values_cat = []; 41 } 42 43 let values_topic = jQuery('#dropdownHover_3 input:checked').map(function() { 44 return $(this).val().replace(/\s+/g, ''); 45 }).get(); 46 47 if(values_topic.length === 0) { 48 values_topic = []; 49 } 50 51 // Optional: Scroll to top of posts when pagination is clicked 52 $('html, body').animate({ 53 scrollTop: gridWrap.offset().top - 150 54 }, 500); 55 56 var clickedLink = $(this); 57 var pageNum = clickedLink.attr('href').match(/(\d+)/)[1]; // Extract the page number from the URL 58 59 $.ajax({ 60 url: ajax_pagination_params.ajax_url, 61 type: 'post', 62 dataType: 'json', // Expect a JSON response 63 data: { 64 action: 'handle_ajax_pagination', 65 page: pageNum, 66 nonce: ajax_pagination_params.nonce, 67 'type' : values_type, 68 'cat' : values_cat, 69 'topic' : values_topic 70 }, 71 success: function(response) { 72 if (response.posts) { 73 siteContent.html(response.posts); // Replace posts 74 pagination.html(response.pagination); // Replace pagination 75 siteContent.css('opacity', '1'); // Remove loading indicator 76 77 // Optional: Scroll to top of posts 78 $('html, body').animate({ 79 scrollTop: gridWrap.offset().top - 150 80 }, 500); 81 } else { 82 siteContent.html('<p>No results found.</p>'); 83 pagination.html(''); 84 } 85 setTimeout( function() { 86 loading.addClass('hidden') 87 siteContent.removeClass( 'hidden' ) 88 paginationLinks.removeClass('hidden') 89 }, 2000); 90 }, 91 error: function(jqXHR, textStatus, errorThrown) { 92 console.error("AJAX Error: " + textStatus, errorThrown); 93 siteContent.css('opacity', '1'); 94 } 95 }); 96 }); 97});
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.