1 2 3jQuery(document).ready(function ($) { 4 // Press Search 5 $("#press-search").on("keyup", function () { 6 var searchVal = $(this).val().trim(); 7 if (searchVal.length < 2) { 8 $("#press-search-results").html("").hide(); 9 return; 10 } 11 12 $.ajax({ 13 url: press_ajax_object.ajax_url, 14 type: "POST", 15 data: { 16 action: "press_ajax_search", 17 search: searchVal, 18 }, 19 beforeSend: function () { 20 $("#press-search-results").html('<p class="press-search-results--text">Searching...</p>').show(); 21 }, 22 success: function (response) { 23 if (response.success && response.data.length > 0) { 24 var resultsHtml = "<ul>"; 25 response.data.forEach(function (item) { 26 resultsHtml += `<li>`; 27 resultsHtml += `<a class="card-press card-press-sm" href="${item.link}">`; 28 resultsHtml += `<div class="card-press-date">${item.date}</div>`; 29 resultsHtml += `<h4 class="card-press-title">${item.title}</h4>`; 30 resultsHtml += `</a>`; 31 resultsHtml += `</li>`; 32 }); 33 resultsHtml += "</ul>"; 34 } else { 35 resultsHtml = `<p class="press-search-results--text">No results found.</p>`; 36 } 37 $("#press-search-results").html(resultsHtml).show(); 38 }, 39 }); 40 }); 41 42 // Hide results on clicking outside 43 $(document).on("click", function (e) { 44 if (!$(e.target).closest(".press-page-search").length) { 45 $("#press-search-results").hide(); 46 } 47 }); 48 49 /* More Posts Slider */ 50 if ($('.more-posts-slider[data-slider]').length) { 51 $('.more-posts-slider[data-slider]').slick({ 52 slidesToShow: 3, 53 slidesToScroll: 1, 54 arrows: true, 55 dots: true, 56 speed: 500, 57 rows: 0, 58 infinite: true, 59 autoplaySpeed: 5000, 60 touchThreshold: 100, 61 autoplay: true, 62 responsive: [ 63 { 64 breakpoint: 991, 65 settings: { 66 slidesToShow: 2, 67 } 68 }, 69 { 70 breakpoint: 767, 71 settings: { 72 slidesToShow: 1, 73 centerMode: true, 74 centerPadding: '42px', 75 } 76 } 77 ] 78 }); 79 } 80 81});
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.