PageSourceSearch

https://intef.es/wp-content/themes/Tema_INTEF/js/ajax_observatorio.js?ver=1

js intef.es collected 2026-10-01 10:13:26 UTC 7,434 bytes, 266 lines download raw bytes

1
2
3(function($){
4
5
6  /*--------------- EVENTOS ---------------*/
7
8  //Modificacion de filtros
9  $('.buscador_ote').on('change',".filtros_ote", ajaxActualizarListadoObservatorio);
10
11  //Busquedas
12  $('.buscador_ote').on('keypress',"#b_ote", checkEnterKey);
13  $('.buscador_ote').on('click', '[data-busqueda]', ajaxActualizarListadoObservatorio);  // ote  obs
14
15  //Paginacion
16  $('.listado_obs').on('click','#sig_pag_obs', ajaxActualizarListadoObservatorio);
17  $('.listado_obs').on('click','#prev_pag_obs', ajaxActualizarListadoObservatorio);
18
19  //Borrar todos los filtros
20  $('.buscador_ote').on('click','[data-borrar_experiencias]', borrarFiltrosBuscadorObservatorio);
21
22
23  //Variable con los IDs cuando se clican filtros
24  var post_ids = [];
25  var busqueda = "";
26
27  /*----- Funcion que comprueba si ha insertado enter en la búsqueda --*/
28  function checkEnterKey(e){
29    if(e.keyCode == 13){
30      ajaxActualizarListadoObservatorio(e);
31    }
32  }
33
34  /*--------- Funcion que borra todos los filtros del buscador ---------*/
35  function borrarFiltrosBuscadorObservatorio(e){
36
37    $("div.filtro .lista_checks .form-group input").each(function(){
38          //TO-DO
39          $(this).prop('checked',false);
40          $(this).closest('.form-group').removeClass('disabled'); //Habilitar
41
42    });
43    $("#b_ote").val("");
44    busqueda = "";
45    ajaxActualizarListadoObservatorio(e);
46  }
47
48/*-------------- FUNCIONES AJAX -----------*/
49
50    /*-- Funcion Ajax para paginacion,filtrado y busqueda--*/
51function ajaxActualizarListadoObservatorio(e){
52
53 console.log("Info");
54  if(e){
55     e.preventDefault();
56
57     if(e.keyCode == 13){
58       busqueda = $('#b_ote').val();
59     }
60  }
61
62  //busqueda por url
63  var url = window.location.href;
64  if(($(this).data('busqueda') == 'b') || url.includes('busqueda')){
65    busqueda = $('#b_ote').val();
66  }
67
68 var nueva_carga = true;
69
70 /* -- Valores por parte del filtrado --*/
71 /* Obtiene los valores necesarios para el filtrado y paginacion
72 */
73
74var metodologia = [];
75  $.each($("input[name='metodologia']:checked"), function(){
76     metodologia.push($(this).val());
77 });
78
79  var tipologia = [];
80   $.each($("input[name='tipologia']:checked"), function(){
81      tipologia.push($(this).val());
82  });
83
84var producto_final = [];
85  $.each($("input[name='producto-final']:checked"), function(){
86     producto_final.push($(this).val());
87 });
88
89 var elementos = $( ".listado_thumbs" ).data( "elementos" );
90
91 /* -- Valores por parte de la paginacion --*/
92 /*
93 */
94 if ($( this ).attr('id') == 'sig_pag_obs' || $( this ).attr('id') == 'prev_pag_obs' ){
95    num_pag = $(this).attr("data-page").substring(4, $(this).attr("data-page").length);
96    nueva_carga = false;
97 }else{
98    num_pag =1;
99 }
100
101  console.log(post_ids);
102  //Obtiene los ids de las materias y etapas educativas que deberian ser clicables
103  $.ajax({
104    url : vars.ajaxurl,
105    type: 'post',
106    data: {
107      action : 'actualizaListadoObservatorio', //functions-observatorios.php
108      metodologia: metodologia,
109      producto_final: producto_final,
110      tipologia: tipologia,
111      num_elem: elementos,
112      num_pag: num_pag,
113      post_ids: post_ids,
114      nueva_carga: nueva_carga,
115      busqueda: busqueda,
116    },
117    beforeSend: function(){
118      //scrollTop();
119    },
120    success: function(resultado){
121      //Actualización del div, incluida la paginacion
122      var json = JSON.parse(resultado);
123      $( ".listado_obs" ).html(json["html"]);
124      post_ids = json["post_ids"];
125
126      $( ".contenido_obs  .num_muestra" ).html("Mostrando "+ json["total"] + " de "+ post_ids.length);
127      $( ".contenido_obs  .filtrando" ).html(json["filtrando"]);
128      //console.log("HTML"+ json["html"]);
129      console.log(json["post_ids"])
130    },
131    complete:function(data){
132   }
133
134});
135
136
137}//Actualizar Lista
138
139
140
141
142/*---------obtene el id de la pagina del body---------*/
143 function get_current_page_id() {
144
145  var page_body = $('body.page');
146  var id = 0;
147
148  if(page_body) {
149      var classList = page_body.attr('class').split(/\s+/);
150      $.each(classList, function(index, item) {
151          if (item.indexOf('page-id') >= 0) {
152              var item_arr = item.split('-');
153              id =  item_arr[item_arr.length -1];
154              return false;
155          }
156      });
157  }
158  return id;
159}
160
161
162desplegable = $(".cont_filtros");
163
164$(".buscador_ote" ).on( "click", "a.desplegar_filtro", function() {
165
166   if (desplegable .is(':hidden') == true) {
167     //console.log('despliega1');
168      desplegar_filtro(jQuery(this));
169   }
170   else {
171     //console.log('pliega1');
172     plegar_filtro(jQuery(this));
173   }
174  }
175);
176
177/*---------------------------desplegar filtro---------------------------*/
178function desplegar_filtro(tl) {
179           desplegable.stop(true, true).delay(0).slideDown(200, function() {
180              //console.log('despliega2');
181
182           });
183           tl.parents(".filtros").addClass('abierto');
184
185       }
186
187
188 /*-----------------plegar filtro--------------------*/
189
190        function plegar_filtro(tl) {
191         desplegable.stop(true, true).delay(0).slideUp(200, function() {
192            //console.log('pliega2');
193             tl.parents(".filtros").removeClass('abierto');
194         });
195
196        }
197
198
199
200
201})(jQuery);
202
203
204
205/*--------------funcion leer más itinerarios-------------------*/
206
207        (function ($){
208        $.leermas = function leerMas(tl){
209           img_height = 120;
210           leer_height = $(tl).height();
211           texto_height = $(tl).find('.acordeon').height();
212           cab_height = leer_height - texto_height;
213           max_height = 120 -  cab_height ;
214          // img_height = $(tl).parent().find('figure').height();
215
216
217           if ( texto_height >  max_height  ) {
218             $(tl).find('.crop').height(max_height);
219             $(tl).find('.crop').addClass('ellipsis');
220
221           }
222           else {
223            //   $(tl).find('.ver_todos').addClass('oculto');
224           }
225
226           $(tl).on('click','.mas', function(event) {
227             leer_height = $(tl).height();
228             texto_height = $(tl).find('.acordeon').height();
229             cab_height = leer_height - texto_height;
230             max_height = 120 -  cab_height ;
231             texto_height = $(tl).find('.acordeon').height();
232          //   console.log ('click: ' + texto_height);
233              $(tl).find('.crop').height(texto_height);
234              $(tl).find('.crop').removeClass('ellipsis');
235              $(tl).find('.ver_todos').text('Ver menos');
236              $(tl).find('.mas').toggleClass('menos');
237              $(tl).find('.mas').toggleClass('mas');
238
239              setTimeout(function() {
240                   $(tl).parents('.recurso').addClass('abierto');
241             }, 500);
242
243
244           });
245
246           $(tl).on('click','.menos', function(event) {
247             leer_height = $(tl).height();
248             texto_height = $(tl).find('.acordeon').height();
249             cab_height = leer_height - texto_height;
250             max_height = 120 -  cab_height ;
251
252              $(tl).parents('.recurso').removeClass('abierto');
253              setTimeout(function() {
254                $(tl).find('.crop').height(max_height);
255                $(tl).find('.crop').addClass('ellipsis');
256                $(tl).find('.menos').text('Ver más');
257                $(tl).find('.menos').toggleClass('mas');
258                $(tl).find('.menos').toggleClass('menos');
259             }, 100);
260
261
262           });
263          // console.log('go');
264        }
265
266        })(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.