PageSourceSearch

https://www.unirioja.es/wp-content/plugins/ele-custom-skin/assets/js/ecs_ajax_pagination.js?ver=4.3.8

js unirioja.es collected 2026-09-24 07:36:15 UTC 3,823 bytes, 103 lines download raw bytes

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

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.