1(function($) { 2 "use strict"; 3 4 function updateFilter() { 5 $('.project_filters a').each(function() { 6 var data_filter = this.getAttribute('data-filter'); 7 var num = $(this) 8 .closest('.project-filter-wrapper') 9 .find('.project-item') 10 .filter(data_filter).length; 11 $(this) 12 .find('.filter-count') 13 .text( num ); 14 if ( num != 0 && $(this).hasClass('empty') ) { 15 $(this).removeClass('empty'); 16 } 17 }); 18 } 19 20 function loadmore(){ 21 22 var btn = $(this), 23 grid = $(this).parents('.project-filter-wrapper').find('.projects-grid'), 24 offset = grid.find('.project-item').length, 25 more = grid.data('load'), 26 loaded = $(this).data('loaded'), 27 loading = $(this).data('loading'), 28 cat = $(this).data('category'), 29 style = $(this).data('style'), 30 count = grid.data('count'); 31 32 $.ajax({ 33 url : progrisaas_loadmore_params.ajaxurl, // AJAX handler 34 data : { 35 'action': 'loadmore', // the parameter for admin-ajax.php 36 'ppp' : more, 37 'cat' : cat, 38 'offset': offset, 39 'style' : style, 40 }, 41 type : 'POST', 42 beforeSend : function ( xhr ) { 43 btn.text(loading).append('<i class="ot-flaticon-refresh fas fa-spin"></i>'); // some type of preloader 44 }, 45 success : function( data ){ 46 if( data ) { 47 var items = $(data); 48 btn.text(loaded); 49 grid.append(items).isotope('appended', items); // insert new posts 50 updateFilter(); 51 if( grid.hasClass('img-popup') ){ 52 grid.data("lightGallery").destroy(true); 53 grid.lightGallery({ 54 selector: '.projects-thumbnail', 55 share: false, 56 pager: false, 57 thumbnail: false 58 }); 59 } 60 61 } else { 62 btn.hide(); // if no data, HIDE the button as well 63 } 64 } 65 }); 66 offset += more; 67 if( count <= offset ){ 68 btn.fadeOut(1000); 69 } 70 return false; 71 } 72 73 var projectLoadmore = function ($scope, $) { 74 $scope.find('.project-filter-wrapper').each(function () { 75 var selector = $(this).find('.btn-loadmore'); 76 selector.on('click', loadmore); 77 }); 78 }; 79 80 /** 81 * Elementor JS Hooks 82 */ 83 $(window).on("elementor/frontend/init", function () { 84 85 /*projects filter isotope*/ 86 elementorFrontend.hooks.addAction( 87 "frontend/element_ready/ipfilter.default", 88 projectLoadmore 89 ); 90 91 }); 92 93})(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.