1( function( $ ) { 2 3 var loadStatus = true; 4 var count = 1; 5 var loader = ''; 6 var total = 0; 7 8 function equalHeight( slider_wrapper ) { 9 var slickSlider = slider_wrapper.find('.pp-posts-carousel'), 10 equalHeight = slickSlider.data( 'equal-height' ); 11 12 if ( 'yes' != equalHeight ) { 13 return; 14 } 15 16 slickSlider.find('.slick-slide').height('auto'); 17 18 var slickTrack = slickSlider.find('.slick-track'), 19 slickTrackHeight = $(slickTrack).height(); 20 21 slickSlider.find('.slick-slide').css('height', slickTrackHeight + 'px'); 22 } 23 24 var PostsHandler = function( $scope, $ ) { 25 26 var container = $scope.find( '.pp-posts-container' ), 27 selector = $scope.find( '.pp-posts-grid' ), 28 layout = $scope.find( '.pp-posts' ).data( 'layout' ), 29 search = $scope.find( '.pp-post-filters-container' ).data( 'search-form' ), 30 $search_input = $scope.find( '.pp-search-form-input' ), 31 search_action = $scope.find( '.pp-post-filters-container' ).data( 'search-action' ), 32 loader = $scope.find( '.pp-posts-loader' ); 33 34 if ( 'masonry' == layout ) { 35 36 $scope.imagesLoaded( function(e) { 37 38 selector.isotope({ 39 layoutMode: layout, 40 itemSelector: '.pp-grid-item-wrap', 41 }); 42 43 }); 44 } 45 46 set_posts_count( $scope, 1 ); 47 48 $scope.find( '.pp-post-filter' ).off( 'click' ).on( 'click', function() { 49 $( this ).siblings().removeClass( 'pp-filter-current' ); 50 $( this ).addClass( 'pp-filter-current' ); 51 count = 1; 52 53 _postsFilterAjax( $scope, $( this ) ); 54 55 }); 56 57 if ( 'show' == search ) { 58 $search_input.on({ 59 focus: function focus() { 60 $scope.find( '.pp-search-form' ).addClass('pp-search-form-focus'); 61 }, 62 blur: function blur() { 63 $scope.find( '.pp-search-form' ).removeClass('pp-search-form-focus'); 64 } 65 }); 66 67 if ( 'instant' == search_action ) { 68 $scope.find('.pp-search-form-input').keyup(debounce(function () { 69 _postsSearchAjax( $scope, $( this ) ); 70 })); 71 72 // debounce so filtering doesn't happen every millisecond 73 function debounce(pp, threshold) { 74 var timeout; 75 threshold = threshold || 100; 76 return function debounced() { 77 clearTimeout(timeout); 78 var args = arguments; 79 var _this = this; 80 81 function delayed() { 82 pp.apply(_this, args); 83 } 84 timeout = setTimeout(delayed, threshold); 85 }; 86 } 87 } else if ( 'button-click' == search_action ) { 88 $scope.find( '.pp-search-form-submit' ).on( 'click', function() { 89 90 _postsSearchAjax( $scope, $( this ) ); 91 92 }); 93 } 94 } 95 96 if ( container.find('.pp-posts').hasClass( 'pp-posts-skin-checkerboard' ) && $scope.hasClass( 'pp-equal-height-yes' ) ) { 97 function setEqualHeight() { 98 var elementorBreakpoints = elementorFrontend.config.breakpoints, 99 maxHeight = 0, 100 $height = 'auto'; 101 102 $scope.find('.pp-post-wrap').each( function() { 103 if( $(this).find('.pp-post-content').outerHeight() > maxHeight ){ 104 maxHeight = $(this).find('.pp-post-content').outerHeight(); 105 } 106 }); 107 if ($(window).width() >= elementorBreakpoints.md) { 108 $height = maxHeight; 109 } 110 $scope.find('.pp-post-wrap').css('height',$height); 111 } 112 113 if ( container.find('.pp-posts').hasClass( 'pp-posts-height-auto' ) ) { 114 $(setEqualHeight); 115 $(window).resize(setEqualHeight); 116 } 117 } 118 119 if ( container.hasClass( 'pp-posts-infinite-scroll' ) ) { 120 121 var windowHeight50 = jQuery( window ).outerHeight() / 1.25; 122 123 $( window ).scroll( function () { 124 125 if ( elementorFrontend.isEditMode() ) { 126 loader.show(); 127 return false; 128 } 129 130 if ( ( $( window ).scrollTop() + windowHeight50 ) >= ( $scope.find( '.pp-post:last' ).offset().top ) ) { 131 132 var $args = { 133 'page_id': $scope.find( '.pp-posts-grid' ).data('page'), 134 'widget_id': $scope.data( 'id' ), 135 'filter': $scope.find( '.pp-filter-current' ).data( 'filter' ), 136 'taxonomy': $scope.find( '.pp-filter-current' ).data( 'taxonomy' ), 137 'skin': $scope.find( '.pp-posts-grid' ).data( 'skin' ), 138 'page_number': $scope.find( '.pp-posts-pagination .current' ).next( 'a' ).html() 139 }; 140 141 total = $scope.find( '.pp-posts-pagination-wrap' ).data( 'total' ); 142 143 if( true == loadStatus ) { 144 145 if ( count < total ) { 146 loader.show(); 147 _callAjax( $scope, $args, true ); 148 count++; 149 loadStatus = false; 150 } 151 152 } 153 } 154 } ); 155 } 156 157 if ( 'carousel' == layout ) { 158 var $carousel = $scope.find( '.pp-posts-carousel' ).eq( 0 ),
159 $slider_options = JSON.parse( $carousel.attr('data-slider-settings') ); 160 161 if ( $carousel.length > 0 ) { 162 $scope.imagesLoaded( function() { 163 $carousel.slick($slider_options); 164 }); 165 } 166 167 $($carousel).on('setPosition', function () { 168 equalHeight($scope); 169 }); 170 } 171 } 172 173 $( document ).on( 'click', '.pp-post-load-more', function( e ) { 174 175 $scope = $( this ).closest( '.elementor-widget-pp-posts' ); 176 loader = $scope.find( '.pp-posts-loader' ); 177 178 e.preventDefault(); 179 180 if( elementorFrontend.isEditMode() ) { 181 loader.show(); 182 return false; 183 } 184 185 var page_count = get_posts_count( $scope ), 186 category = $scope.find( '.pp-filter-current' ).data( 'filter' ), 187 taxonomy = $scope.find( '.pp-filter-current' ).data( 'taxonomy' ); 188 189 var $args = { 190 'page_id': $scope.find( '.pp-posts-grid' ).data('page'), 191 'widget_id': $scope.data( 'id' ), 192 'filter': ( category ) ? category : '', 193 'taxonomy': ( taxonomy ) ? taxonomy : '', 194 'skin': $scope.find( '.pp-posts-grid' ).data( 'skin' ), 195 'page_number': ( page_count + 1 ) 196 }; 197 198 total = $scope.find( '.pp-posts-pagination-wrap' ).data( 'total' ); 199 200 if( true == loadStatus ) { 201 202 if ( page_count < total ) { 203 loader.show(); 204 $( this ).hide(); 205 _callAjax( $scope, $args, true, page_count ); 206 page_count++; 207 loadStatus = false; 208 } 209 210 } 211 } ); 212 213 function get_posts_count( $scope ) { 214 return $scope.find('.pp-post-load-more').data('count'); 215 } 216 function set_posts_count( $scope, count ) { 217 $scope.find('.pp-post-load-more').attr('data-count', count); 218 } 219 220 $( 'body' ).delegate( '.pp-posts-pagination-ajax .page-numbers', 'click', function( e ) { 221 222 $scope = $( this ).closest( '.elementor-widget-pp-posts' ); 223 224 if ( 'main' == $scope.find( '.pp-posts-grid' ).data( 'query-type' ) ) { 225 return; 226 } 227 228 e.preventDefault(); 229 230 $scope.find( '.pp-posts-grid .pp-post' ).last().after( '<div class="pp-post-loader"><div class="pp-loader"></div><div class="pp-loader-overlay"></div></div>' ); 231 232 var page_number = 1; 233 var curr = parseInt( $scope.find( '.pp-posts-pagination .page-numbers.current' ).html() ); 234 235 if ( $( this ).hasClass( 'next' ) ) { 236 page_number = curr + 1; 237 } else if ( $( this ).hasClass( 'prev' ) ) { 238 page_number = curr - 1; 239 } else { 240 page_number = $( this ).html(); 241 } 242 243 $scope.find( '.pp-posts-grid .pp-post' ).last().after( '<div class="pp-post-loader"><div class="pp-loader"></div><div class="pp-loader-overlay"></div></div>' ); 244 245 var $args = { 246 'page_id': $scope.find( '.pp-posts-grid' ).data('page'), 247 'widget_id': $scope.data( 'id' ), 248 'filter': $scope.find( '.pp-filter-current' ).data( 'filter' ), 249 'taxonomy': $scope.find( '.pp-filter-current' ).data( 'taxonomy' ), 250 'skin': $scope.find( '.pp-posts-grid' ).data( 'skin' ), 251 'page_number': page_number 252 }; 253 254 $('html, body').animate({ 255 scrollTop: ( ( $scope.find( '.pp-posts-container' ).offset().top ) - 30 ) 256 }, 'slow'); 257 258 _callAjax( $scope, $args ); 259 260 } ); 261 262 var _postsFilterAjax = function( $scope, $this ) { 263 264 $scope.find( '.pp-posts-grid .pp-grid-item-wrap' ).last().after( '<div class="pp-posts-loader-wrap"><div class="pp-loader"></div><div class="pp-loader-overlay"></div></div>' ); 265 266 var $args = { 267 'page_id': $scope.find( '.pp-posts-grid' ).data('page'), 268 'widget_id': $scope.data( 'id' ), 269 'filter': $this.data( 'filter' ), 270 'taxonomy': $this.data( 'taxonomy' ), 271 'skin': $scope.find( '.pp-posts-grid' ).data( 'skin' ), 272 'page_number': 1 273 }; 274 275 _callAjax( $scope, $args ); 276 } 277 278 var _postsSearchAjax = function( $scope, $this ) { 279 280 $scope.find( '.pp-posts-grid .pp-grid-item-wrap' ).last().after( '<div class="pp-posts-loader-wrap"><div class="pp-loader"></div><div class="pp-loader-overlay"></div></div>' ); 281 282 var $args = { 283 'page_id': $scope.find( '.pp-posts-grid' ).data('page'), 284 'widget_id': $scope.data( 'id' ), 285 'search': $scope.find( '.pp-search-form-input' ).val(), 286 'page_number': 1 287 }; 288 289 _callAjax( $scope, $args ); 290 } 291 292 var _callAjax = function( $scope, $obj, $append, $count ) { 293 294 var loader = $scope.find( '.pp-posts-loader' ); 295 296 $.ajax({
297 url: pp.ajax_url, 298 data: { 299 action: 'pp_get_post', 300 page_id: $obj.page_id, 301 widget_id: $obj.widget_id, 302 category: $obj.filter, 303 search: $obj.search, 304 taxonomy: $obj.taxonomy, 305 skin: $obj.skin, 306 page_number: $obj.page_number, 307 nonce: pp_posts_script.posts_nonce, 308 }, 309 dataType: 'json', 310 type: 'POST', 311 success: function( data ) { 312 313 var sel = $scope.find( '.pp-posts-grid' ); 314 315 if ( true == $append ) { 316 317 var html_str = data.data.html; 318 319 sel.append( html_str ); 320 } else { 321 sel.html( data.data.html ); 322 } 323 324 $scope.find( '.pp-posts-pagination-wrap' ).html( data.data.pagination ); 325 326 var layout = $scope.find( '.pp-posts-grid' ).data( 'layout' ), 327 selector = $scope.find( '.pp-posts-grid' ); 328 329 if ( 'masonry' == layout ) { 330 331 $scope.imagesLoaded( function() { 332 selector.isotope( 'destroy' ); 333 selector.isotope({ 334 layoutMode: layout, 335 itemSelector: '.pp-grid-item-wrap', 336 }); 337 }); 338 } 339 340 // Complete the process 'loadStatus' 341 loadStatus = true; 342 if ( true == $append ) { 343 loader.hide(); 344 $scope.find( '.pp-post-load-more' ).show(); 345 } 346 347 set_posts_count( $scope, $obj.page_number ); 348 349 $count = $count + 1; 350 351 if( $count == total ) { 352 $scope.find( '.pp-post-load-more' ).hide(); 353 } 354 } 355 }); 356 } 357 358 $( window ).on( 'elementor/frontend/init', function () { 359 360 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.classic', PostsHandler ); 361 362 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.card', PostsHandler ); 363 364 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.checkerboard', PostsHandler ); 365 366 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.creative', PostsHandler ); 367 368 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.event', PostsHandler ); 369 370 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.news', PostsHandler ); 371 372 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.portfolio', PostsHandler ); 373 374 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.overlap', PostsHandler ); 375 376 elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-posts.template', PostsHandler ); 377 378 }); 379 380} )( 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.