1jQuery( document ).ready(function() { 2 jQuery( ".ecs-load-more-button" ).each(function() { 3 widget=jQuery(this); 4 settings = widget.attr("data-settings"); 5 args = JSON.parse(settings); 6 widget.children( ".elementor-button" ).attr("href", "javascript:ECS_load_next_page('"+ args.widget_id +"');"); 7 }); 8}); 9var canBeLoaded = true; // this param allows to initiate the AJAX call only if necessary 10 11 12function ECS_load_next_page(id){ 13 14 widget = jQuery(".elementor-element[data-id='" + id + "'] .ecs-posts"); 15 settings = widget.attr("data-settings"); 16 args = JSON.parse(settings); 17 18 posts = jQuery(".elementor-element[data-id='" + args.widget_id + "'] .ecs-posts"); 19 20 if(args.load_method == 'loadmore'){ 21 button_text = jQuery(".elementor-element[data-id='" + args.widget_id + "'] .ecs-load-more-button .elementor-button");// add this .elementor-element[data-id='" + args.widget_id + "'] 22 button = jQuery(".elementor-element[data-id='" + args.widget_id + "'] .ecs-load-more-button"); 23 attb = JSON.parse(button.attr("data-settings")); 24 } 25 if(args.load_method == 'lazyload'){ 26 animation = jQuery(".elementor-element[data-id='" + args.widget_id + "'] .ecs-lazyload"); 27 } 28 data = { 29 'action': 'ecsload', 30 'query': ecs_ajax_params.posts, 31 'ecs_ajax_settings': settings, 32 }; 33 34 jQuery.ajax({ 35 url : ecs_ajax_params.ajaxurl, // AJAX handler 36 data : data, 37 type : 'POST', 38 beforeSend : function ( xhr ) { 39 if(args.load_method == 'loadmore') button_text.html(attb.loading_text); // change the button text, you can also add a preloader image 40 canBeLoaded = false; 41 }, 42 success : function( data ){ 43 if( data ) { 44 posts.append(data); // insert new posts 45 args.current_page++; 46 if(args.load_method == 'loadmore'){ 47 button_text.html( attb.text ); 48 button_text.blur(); 49 } 50 newsettings = JSON.stringify(args); 51 widget.attr("data-settings",newsettings); 52 53 54 if(args.load_method == 'lazyload') {jQuery(animation).addClass("animation-hidden");} 55 //here you need to take care of linkable items and masonry !!!!!!!!!!!!!!!!! 56 ECS_do_action('ajax',args); 57 58 if ( args.current_page == args.max_num_pages ) { 59 if(args.load_method == 'loadmore') button.remove(); // if last page, remove the button 60 if(args.load_method == 'lazyload') animation.remove(); 61 } 62 canBeLoaded = true; 63 64 if (typeof ECScheckInView !== 'undefined') ECScheckInView(); 65 // you can also fire the "post-load" event here if you use a plugin that requires it 66 // $( document.body ).trigger( 'post-load' ); 67 } else { 68 if(args.load_method == 'loadmore') {button.remove();} // if no data, remove the button as well 69 if(args.load_method == 'lazyload') {animation.remove();} 70 } 71 } 72 }); 73 74} 75 76 77jQuery(function($){ 78 $('.ecs-lazyload').addClass("animation-hidden"); 79 $('.ecs-lazyload a').css("display", "none"); 80}); 81 82function EleCustomSkinChangeUrlPage(args){ 83 if(!args.change_url) return; 84 regex = /\/page\/[0-9]+\//gm; 85 currenturl = window.location.pathname; 86 newurl = currenturl.replace(regex, '/'); 87 newurl = newurl + 'page/' + args.current_page +'/'; 88 console.log(newurl); 89 history.pushState({urlPath:newurl},"",newurl); 90} 91 92function EleCustomSkinReInitJs(args){ 93 if(!args.reinit_js) return; 94 jQuery('.elementor-element-' + args.widget_id + ' .elementor-element').each(function() { elementorFrontend.elementsHandler.runReadyTrigger( jQuery( this ) ); });console.log(args.reinit_js); 95} 96 97jQuery( document ).ready(function() { 98 99 ECS_add_action("ajax", function(args){EleCustomSkinChangeUrlPage(args)}); 100 ECS_add_action("ajax", function(args){EleCustomSkinReInitJs(args)}); 101 102});
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.