1( function( $ ) { 2 "use strict"; 3 4 $( window ).on( 'elementor/frontend/init', function() { 5 6 setTimeout(function(){ 7 $('.pxl-grid').each(function(index, element) { 8 var $grid_scope = $(this); 9 var $grid_masonry = $grid_scope.find('.pxl-grid-masonry'); 10 var isoOptions = { 11 itemSelector: '.pxl-grid-item', 12 layoutMode: 'masonry', 13 fitRows: { 14 gutter: 0 15 }, 16 percentPosition: true, 17 masonry: { 18 columnWidth: '.grid-sizer', 19 }, 20 containerStyle: null, 21 stagger: 30, 22 sortBy : 'name', 23 }; 24 var $grid_isotope = $grid_masonry.isotope(isoOptions); 25 26 let filterItem = $grid_scope.closest('.elementor-element.e-parent').find('.pxl-filter-wrapper .filter-item'); 27 filterItem.on('click', function(e) { 28 e.preventDefault(); 29 var $this = $(this); 30 var term_slug = $this.attr('data-filter'); 31 32 $this.siblings('.filter-item.active').removeClass('active'); 33 $this.addClass('active'); 34 $grid_scope.find('.pxl-post--inner').removeClass('animated'); 35 36 if( $this.closest('.pxl-filter-inner').hasClass('ajax') ){ 37 var loadmore = $grid_scope.data('loadmore'); 38 loadmore.term_slug = term_slug; 39 ainus_grid_ajax_handler( $this, $grid_scope, $grid_isotope, 40 { action: 'ainus_load_more_post_grid', loadmore: loadmore, iso_options: isoOptions, handler_click: 'filter', scrolltop: 0 } 41 ); 42 }else{ 43 $grid_isotope.isotope({ filter: term_slug }); 44 45 if( $grid_scope.find('.pxl-filter-inner').hasClass('pxl-animate') ){ 46 var $animate_el = $grid_scope.find('.pxl-filter-inner'), 47 data = $animate_el.data('settings'); 48 if(typeof data != 'undefined' && typeof data['animation'] != 'undefined'){ 49 setTimeout(function () { 50 $animate_el.removeClass('pxl-invisible').addClass('animated ' + data['animation']); 51 }, data['anim_delay']); 52 }else{ 53 setTimeout(function () { 54 $animate_el.removeClass('pxl-invisible').addClass('animated fadeInUp'); 55 }, 300); 56 } 57 } 58 } 59 }) 60 $grid_scope.on('click', '.pxl-grid-filter .filter-item', function(e) { 61 62 var $this = $(this); 63 var term_slug = $this.attr('data-filter'); 64 65 $this.siblings('.filter-item.active').removeClass('active'); 66 $this.addClass('active'); 67 $grid_scope.find('.pxl-post--inner').removeClass('animated'); 68 69 if( $this.closest('.pxl-grid-filter').hasClass('ajax') ){ 70 var loadmore = $grid_scope.data('loadmore'); 71 loadmore.term_slug = term_slug; 72 ainus_grid_ajax_handler( $this, $grid_scope, $grid_isotope, 73 { action: 'ainus_load_more_post_grid', loadmore: loadmore, iso_options: isoOptions, handler_click: 'filter', scrolltop: 0 } 74 ); 75 }else{ 76 $grid_isotope.isotope({ filter: term_slug }); 77 if( $grid_scope.find('.pxl-grid-filter').hasClass('pxl-animate') ){ 78 var $animate_el = $grid_scope.find('.pxl-grid-filter'), 79 data = $animate_el.data('settings'); 80 if(typeof data != 'undefined' && typeof data['animation'] != 'undefined'){ 81 setTimeout(function () { 82 $animate_el.removeClass('pxl-invisible').addClass('animated ' + data['animation']); 83 }, data['anim_delay']); 84 }else{ 85 setTimeout(function () { 86 $animate_el.removeClass('pxl-invisible').addClass('animated fadeInUp'); 87 }, 300); 88 } 89 } 90 } 91 }); 92 93 $grid_scope.on('click', '.pxl-grid-pagination .ajax a.page-numbers', function(e) { 94 e.preventDefault(); 95 e.stopPropagation(); 96 var $this = $(this); 97 var loadmore = $grid_scope.data('loadmore'); 98 var paged = $this.attr('href'); 99 paged = paged.replace('#', ''); 100 loadmore.paged = parseInt(paged); 101 ainus_grid_ajax_handler( $this, $grid_scope, $grid_isotope, 102 { action: 'ainus_load_more_post_grid', loadmore: loadmore, iso_options: isoOptions, handler_click: 'pagination', scrolltop: 0, wpnonce: main_data.wpnonce } 103 ); 104 $('html,body').animate({scrollTop: $grid_scope.offset().top - 130}, 500); 105 }); 106 107 108 // Load More 109 $grid_scope.on('click', '.pxl-load-more-button', function(e) { 110 e.preventDefault(); 111 var $this = $(this); 112 var loadmore = $grid_scope.data('loadmore'); 113 loadmore.paged = parseInt($grid_scope.data('start-page')) + 1; 114 115 ainus_grid_ajax_handler( $this, $grid_scope, $grid_isotope, { 116 action: 'ainus_load_more_post_grid', 117 loadmore: loadmore, 118 iso_options: isoOptions, 119 handler_click: 'loadmore', 120 scrolltop: 0, 121 wpnonce: main_data.wpnonce 122 }); 123 }); 124 }); 125 }, 300); 126 127 128 function ainus_grid_ajax_handler($this, $grid_scope, $grid_isotope, args = {}){ 129 var settings = $.extend( true, {}, { 130 action: '', 131 loadmore: '', 132 iso_options: {}, 133 handler_click: '', 134 scrolltop: 0, 135 wpnonce: '' 136 }, args ); 137 138 $.ajax({ 139 url: main_data.ajax_url, 140 type: 'POST', 141 data: { 142 action: settings.action, 143 settings: settings.loadmore, 144 handler_click: settings.handler_click, 145 wpnonce: settings.wpnonce 146 }, 147 beforeSend: function() { 148 settings.scrollTop = $(window).scrollTop(); 149 if(settings.handler_click === 'loadmore') { 150 $this.addClass('loading'); 151 $grid_scope.css({'pointer-events' : 'none'}) 152 } 153 }, 154 success: function( res ) { 155 if(res.status == true){ 156 let newHtml = $(res.data.html); 157 if( settings.handler_click == 'loadmore' ){ 158 $grid_scope.find('.pxl-grid-inner').append(newHtml); 159 }else{ 160 $grid_scope.find('.pxl-grid-inner .pxl-grid-item').remove(); 161 $grid_scope.find('.pxl-grid-inner').append(newHtml); 162 } 163 if( settings.iso_options){ 164 $grid_isotope.isotope('destroy'); 165 $grid_isotope.isotope(settings.iso_options); 166 } 167 if( $grid_scope.find('.pxl-grid-filter').hasClass('pxl-animate') ){ 168 var $animate_el = $grid_scope.find('.pxl-grid-filter'), 169 data = $animate_el.data('settings'); 170 if(typeof data != 'undefined' && typeof data['animation'] != 'undefined'){ 171 setTimeout(function () { 172 $animate_el.removeClass('pxl-invisible').addClass('animated ' + data['animation']); 173 }, data['anim_delay']); 174 }else{ 175 setTimeout(function () { 176 $animate_el.removeClass('pxl-invisible').addClass('animated fadeInUp'); 177 }, 300); 178 } 179 } 180 $grid_scope.data('start-page', res.data.paged); 181 182 if( settings.loadmore['pagination'] == 'pagination'){ 183 $grid_scope.find(".pxl-grid-pagination").html(res.data.pagin_html); 184 } 185 186 if(settings.handler_click === 'loadmore') { 187 if(res.data.paged >= res.data.max) $this.hide(); 188 else $this.show(); 189 } 190 } 191 }, 192 complete: function() { 193 $(window).scrollTop(settings.scrollTop); 194 if(settings.handler_click === 'loadmore') { 195 $this.removeClass('loading'); 196 $grid_scope.css({'pointer-events' : 'visible'}) 197 } 198 } 199 }); 200 } 201 }); 202 203} )( 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.