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 : theratio_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="fas fa-sync-alt 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 if( grid.hasClass('style-6') ){ 53 var all_links = document.querySelectorAll('h5 a.title-link'); 54 for(var i=0; i<all_links.length; i++){ 55 all_links[i].removeAttribute("href"); 56 } 57 } 58 grid.data("lightGallery").destroy(true); 59 grid.lightGallery({ 60 selector: '.style-3 .projects-thumbnail, .style-4 .projects-thumbnail, .style-6 h5 a', 61 share: false, 62 pager: false, 63 thumbnail: false 64 }); 65 } 66 67 } else { 68 btn.hide(); // if no data, HIDE the button as well 69 } 70 } 71 }); 72 offset += more; 73 if( count <= offset ){ 74 btn.fadeOut(1000); 75 } 76 return false; 77 } 78 79 var projectLoadmore = function ($scope, $) { 80 $scope.find('.project-filter-wrapper').each(function () { 81 var selector = $(this).find('.btn-loadmore'); 82 selector.on('click', loadmore); 83 }); 84 }; 85 86 var projectLoadmoreMetro = function ($scope, $) { 87 $scope.find('.project-filter-wrapper').each(function () { 88 var selector = $(this).find('.btn-loadmore-metro'); 89 selector.on('click', loadmore); 90 }); 91 }; 92 93 /** 94 * Elementor JS Hooks 95 */ 96 $(window).on("elementor/frontend/init", function () { 97 98 /*projects filter isotope*/ 99 elementorFrontend.hooks.addAction( 100 "frontend/element_ready/ipfilter.default", 101 projectLoadmore 102 ); 103 elementorFrontend.hooks.addAction( 104 "frontend/element_ready/ipfilter_metro.default", 105 projectLoadmoreMetro 106 ); 107 108 }); 109 110})(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.