1jQuery(document).ready(function($) { 2 let topic = ''; 3 let type = ''; 4 let sort_by = 'asc'; 5 let offset = 6; 6 const postType = document.getElementById('PostsFilter') ? document.getElementById('PostsFilter').dataset.postType : ''; 7 8 9 const clearData = () => { 10 $('#PostsFilterContainer').empty(); 11 $('#PostsShowing').text('Showing # of # items'); 12 $('#LoadMorePosts').hide(); 13 offset = 0; 14 }; 15 16 const requestData = () => { 17 $.ajax({ 18 url: loadPostsFilter.ajaxurl, 19 type: 'POST', 20 data: { 21 action: 'load_posts_filter', 22 post_type: postType, 23 nonce: loadPostsFilter.nonce, 24 topic: topic, 25 type: type, 26 sort_by: sort_by, 27 offset: offset 28 }, 29 success: function(response) { 30 if (response.posts.length > 0) { 31 response.posts.forEach(function(post) { 32 $('#PostsFilterContainer').append(` 33 <a href="${post.link}" class="tile ${post.additional_class}" target="${post.new_tab ? '_blank' : '_self'}"> 34 ${ post.tag ? '<div class="tile--tag"><h2 class="proxima-nova-bold uppercase font-extrabold">'+ post.tag +'</h2></div>' : ''} 35 <div class="tile--image"> 36 <img src="${ post.image }" alt="${ post.image_alt }" /> 37 </div> 38 <div class="tile--content"> 39 <h3 class="proxima-nova-bold font-extrabold">${ post.title ? post.title : '' }</h3> 40 ${ post.description ? '<p class="tile--content-description">'+ post.description +'</p>' : ''} 41 </div> 42 </a> 43 `); 44 }); 45 $('#PostsShowing').text('Showing ' + $('#PostsFilterContainer').children().length + ' of ' + response.total + ' items'); 46 47 if(response.total <= $('#PostsFilterContainer').children().length) { 48 $('#LoadMorePosts').hide(); 49 } else { 50 $('#LoadMorePosts').show(); 51 // $('#LoadMoreFeaturedPosts').show(); 52 } 53 offset += 6; 54 } else { 55 $('#PostsFilterContainer').append('<p>No posts items found</p>'); 56 // $('#LoadMoreFeaturedPosts').hide(); 57 $('#LoadMorePosts').hide(); 58 $('#PostsShowing').empty(); 59 } 60 } 61 }); 62 }; 63 64 // load more of the latest 65 $('#LoadMorePosts').click(function(e) { 66 e.preventDefault(); 67 requestData(); 68 }); 69 70 $('#posts-filter__filter__content').on('change', function() { 71 type = $(this).val(); 72 clearData(); 73 requestData(); 74 }); 75 76 $('#posts-filter__filter__issue').on('change', function() { 77 topic = $(this).val(); 78 clearData(); 79 requestData(); 80 }); 81 82 $('#posts-filter__filter__order').on('change', function() { 83 sort_by = $(this).val(); 84 clearData(); 85 requestData(); 86 }); 87});
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.