1jQuery(document).ready(function($){ 2 var allEvents = $('#load-upcoming-events').html(); 3 var loadEvents = $('#load-upcoming-events'); 4 var noResults = $('.no-results'); 5 var toggleAll = $('a#toggle'); 6 noResults.hide(); 7 8 var searchInput = $('input#event-search-input'); 9 10 searchInput.on('input', function(event){ 11 var txt = $(this).val().toLowerCase(); 12 if (txt.length > 2) { 13 filterEvents(txt); 14 } 15 }); 16 17 searchInput.on('keyup', function(e){ 18 if (!this.value) { 19 $("ul.event-filter li:first").trigger("click"); 20 loadEvents.html(allEvents); 21 var view_btn = toggleAll.text(); 22 if (view_btn == 'View Less Shows'){ 23 $( ".detail-information" ).each(function( index ) { 24 $(this).show(); 25 }); 26 } 27 toggleAll.show(); 28 } 29 }); 30 31 searchInput.on('keydown', function(e){ 32 if (e.key === "Escape") { 33 this.value = ""; 34 $("ul.event-filter li:first").trigger("click"); 35 loadEvents.html(allEvents); 36 var view_btn = toggleAll.text(); 37 if (view_btn == 'View Less Shows'){ 38 $( ".detail-information" ).each(function( index ) { 39 $(this).show(); 40 }); 41 } 42 } 43 var txt = $(this).val().toLowerCase(); 44 filterEvents(txt); 45 }); 46 47 var search_has_query = $('.home #event-search-input').val(); 48 if (search_has_query) { 49 const offset = $('#upcoming-shows').height(); // Offset in pixels 50 $('html, body').animate({ 51 scrollTop: $('#upcoming-shows').offset().top - offset 52 }, 2000); 53 setTimeout(function() { 54 filterEvents(search_has_query.toLowerCase()); 55 }, 2000); 56 } 57 58 function filterEvents(search) { 59 search = search.replace(/ $/ , ""); 60 loadEvents.hide(); 61 noResults.hide(); 62 toggleAll.hide(); 63 $('.ajax-loader').show(); 64 let totalMatches = 0; 65 $( ".detail-information" ).each(function( index ) { 66 var dataTitle = $(this).attr('data-title').toLowerCase(); 67 var result = dataTitle.includes(search); 68 if(result) { 69 totalMatches++; 70 $(this).show(); 71 } else { 72 $(this).hide(); 73 } 74 }); 75 76 $('.ajax-loader').hide(); 77 if (totalMatches > 0) { 78 loadEvents.show(); 79 } else { 80 noResults.show(); 81 toggleAll.hide(); 82 } 83 } 84 85// Toggle function start 86 // Show first 12 events, hide others 87 88 $(function() { 89 $(".upcoming-events-list .detail-information").slice(js_acf_data).hide(); 90 }); 91 92 // View all, view less 93 $("#toggle").click(function( event ) { 94 95 var $btn = $(this); 96 $btn.text($btn.text() == "View Less Shows" ? "View All Shows" : "View Less Shows"); 97 98 if ( $("#toggle").hasClass("show-init")) { 99 event.preventDefault(); 100 $(this).removeClass("show-init").addClass("show-all"); 101 // Show all Events 102 $(".upcoming-events-list .detail-information").show(); 103 } 104 105 else { 106 event.preventDefault(); 107 $(this).removeClass("show-all").addClass("show-init"); 108 // Collapse to default ACF num 109 $(".upcoming-events-list .detail-information").slice(js_acf_data).hide(); 110 const targetElement = $("#upcoming-shows-title"); 111 if (targetElement.length) { // Check if the element exists 112 $("html, body").animate({ 113 scrollTop: targetElement.offset().top 114 }, 1000); // 1000 milliseconds for the animation duration 115 } 116 } 117 118 }); 119 120}); 121
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.