1;( $ => { 2 3 $( () => { 4 5 6 const loadData = async ( block, loadMore = false ) => { 7 8 const $block = $( block ) 9 const $ajaxFilters = $block.find( '.ajax-filters' ) 10 const $ajaxResponse = $block.find( '.ajax-response' ) 11 12 const formData = $ajaxFilters.serializeArray() 13 14 $ajaxResponse.addClass( 'ajax-loading' ) 15 16 GBWP.changeSearchParams( $.param( formData.filter( it => $.trim( it.value ).length > 0 ) ) ) 17 18 if ( loadMore ) 19 formData.push({ name: 'offset', value: $ajaxResponse.children( '.post' ).length }) 20 formData.push({ name: 'action', value: 'listing_news' }) 21 formData.push({ name: 'nonce', value: GBWPMeta.ajax.nonce }) 22 23 $.ajax( { 24 url: GBWPMeta.ajax.url, 25 method: 'get', 26 data: $.param( formData ), 27 success: res => { 28 29 if ( res.status == 'success' ) { 30 31 if ( ! loadMore ) 32 $ajaxResponse.html( res.content ) 33 else 34 $ajaxResponse.append( res.content ) 35 36 $block.find( '.load-more-btn' ).toggle( res.count < res.totalCount ) 37 38 } else { 39 40 $ajaxResponse.empty() 41 42 } 43 44 }, 45 error: () => { 46 47 $ajaxResponse.empty() 48 49 }, 50 complete: () => { 51 52 $ajaxResponse.removeClass( 'ajax-loading' ) 53 54 } 55 } ) 56 57 } 58 59 $( '.block-news-listing .ajax-filters input' ).on( 'change', ev => { 60 61 $( ev.currentTarget ).closest( '.ajax-filters' ).trigger( 'submit' ) 62 63 } ) 64 65 $( '.block-news-listing .ajax-filters' ).on( 'submit', ev => { 66 67 ev.preventDefault() 68 69 loadData( $( ev.currentTarget ).closest( '.block-news-listing' ) ) 70 71 } ) 72 73 $( '.block-news-listing .load-more-btn' ).on( 'click', ev => { 74 75 ev.preventDefault() 76 77 loadData( $( ev.currentTarget ).closest( '.block-news-listing' ), true ) 78 79 } ) 80 81 } ) 82 83} )( 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.