1(($) => { 2 3 if( !$( '.standard-filters' ) ) return; 4 if( $( 'body' ).hasClass( 'search-results' ) ) return; 5 6 let $reset = $( '.reset-filter, .clear-advanced-filter' ); 7 let $grid = $( '.grid' ); 8 let $gridPagination = $( '.pagination' ); 9 let $url; 10 11 $reset.each(function() { 12 $( this ).on( 'click', (e) => { 13 e.preventDefault(); 14 15 $( '#filters-subcategories' ).removeAttr( 'value' ); 16 $('#filters-themed-events').removeAttr( 'value' ); 17 $( '#filters-act-impact' ).removeAttr( 'value' ); 18 19 $url = e.currentTarget.dataset.slug; 20 21 subCatIds = []; 22 themeIds = []; 23 actIds = []; 24 25 // console.log( "Type: " + subCatIds); 26 // console.log( "Theme: " + themeIds); 27 // console.log( "Impact: " + actIds); 28 29 $( '.no-results' ).fadeOut(); 30 31 $grid.find( '[data-reveal]' ).each(function() { 32 $(this).find("*").css({ "transition-delay" : "0ms" }); 33 $(this).attr('data-reveal', false); 34 }); 35 36 $.ajax({ 37 url: ajaxresetfilters.ajaxurl, 38 type: 'post', 39 data: { 40 action: 'ajax_reset_filters', 41 }, 42 success: function( result ) { 43 setTimeout(() => { 44 let $html = $( '<div />' ).html( $.parseHTML( result ) ); 45 let $cards = $html.find( '.card' ); 46 let $pagination = $html.find( '.pagination' ); 47 $grid.empty(); 48 $grid.append( $cards ); 49 $gridPagination.empty(); 50 $pagination.find( 'a' ).each(function() { 51 let link = $( this ).attr( 'href' ); 52 let base = $url; 53 if( base ) { 54 let newLink = base.substring(0, base.length - 1) + link; 55 $( this ).attr( 'href', newLink ); 56 } 57 }); 58 $gridPagination.append( $pagination.children() ); 59 }, 250); 60 61 setTimeout(() => { 62 if( $( '.active-filter' ).length > 0 ) { 63 $( 'body' ).removeClass( 'advanced-search-in-use' ); 64 65 $( '.active-filter' ).each(function() { 66 $( this ).removeClass( 'active-filter' ); 67 }); 68 69 $( '.reset-filter' ).addClass( 'active' ); 70 } 71 72 $( '.standard-filters' ).find( '.active' ).each( function() { 73 $( this ).removeClass( 'active' ); 74 }); 75 76 $( '.standard-filters li:first-child > a' ).addClass( 'active' ); 77 let $url = $( '.standard-filters li:first-child > a' ).attr( 'href' ); 78 79 window.history.pushState({path: $url}, '', $url); 80 81 $( '.no-results' ).remove(); 82 $( '#filters-themed-events' ).val(''); 83 84 $grid.find( '[data-reveal]' ).each(function() { 85 $(this).attr('data-reveal', 'revealed'); 86 }); 87 }, 550); 88 89 } 90 }); 91 }); 92 }); 93 94})(jQuery);
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.