PageSourceSearch

https://ctxt.es/themes/publication_1/theme_1/js/main.js?20180529

js ctxt.es collected 2026-09-24 08:50:47 UTC 7,677 bytes, 293 lines download raw bytes

1'use strict';
2
3
4
5
6var MOBILE = {
7
8  ancho : 0,
9
10  inicio : function() {
11    MOBILE.calcularAncho();
12    //if ($('body').hasClass('mobile')) {
13      var cabecera = $('#header-mobile');
14      $('#boton-menu').on('click', function() {
15        cabecera.toggleClass('menu');
16        if (!cabecera.hasClass('menu')) {
17          $('#menu').css('left',0);
18          $('#menu .subseccion').hide();
19        }
20      });
21      $('#boton-buscador').on('click', function() {
22        cabecera.toggleClass('buscador');
23        if (cabecera.hasClass('buscador') && (cabecera.find('.gsc-input input').length > 0)) {
24          cabecera.find('.gsc-input input').focus();
25        }
26      });
27      $('#menu .item p, #menu .item button').on('click', function() {
28        MOBILE.submenu($(this));
29      });
30      $('#menu .subseccion > button').on('click', function() {
31        MOBILE.volver($(this));
32      });
33    //}
34  },
35
36  submenu : function(cual) {
37    cual.parent().next().show();
38    $('#menu').animate({ left: '-=' + MOBILE.ancho }, 400);
39  },
40
41  volver : function(cual) {
42    cual.next().show();
43    $('#menu').animate({ left: '+=' + MOBILE.ancho }, 400, function() {
44      cual.parent().hide();
45    });
46  },
47
48  calcularAncho : function() {
49    MOBILE.ancho = $(window).width();
50  },
51
52  reposicionar : function() {
53    var posicion = parseInt($('#menu').css('left'))/MOBILE.ancho;
54    MOBILE.calcularAncho();
55    $('#menu').css('left',posicion*MOBILE.ancho);
56  }
57
58};
59
60
61
62
63var NUMEROS = {
64
65  anchoItem : 0,
66  cuantos : 0,
67  contenedor : null,
68  moviendo : false,
69  seleccionado : 0,
70
71  inicio : function() {
72    NUMEROS.contenedor = $('.numeros');
73    NUMEROS.cuantos = NUMEROS.contenedor.find('div li').length;
74    NUMEROS.anchoItem = NUMEROS.contenedor.find('div li').width();
75    NUMEROS.seleccionado = NUMEROS.contenedor.find('div .seleccionado').index();
76    NUMEROS.contenedor.find('div ol').width(NUMEROS.cuantos*NUMEROS.anchoItem).css('left',-(NUMEROS.seleccionado*NUMEROS.anchoItem));
77    NUMEROS.contenedor.find('> ol button').on('click', function() {
78      NUMEROS.mover($(this).val());
79    });
80  },
81
82  mover : function(sentido) {
83    if (!NUMEROS.moviendo) {
84      if (sentido === 'anterior') {
85        if (NUMEROS.seleccionado > 0) {
86          NUMEROS.moviendo = true;
87          NUMEROS.contenedor.find('div ol').animate({ left: '+=' + NUMEROS.anchoItem }, 400, function() {
88            NUMEROS.seleccionado--;
89            NUMEROS.moviendo = false;
90          });
91        }
92      } else if (sentido === 'siguiente') {
93        if (NUMEROS.seleccionado < (NUMEROS.cuantos-1)) {
94          NUMEROS.moviendo = true;
95          NUMEROS.contenedor.find('div ol').animate({ left: '-=' + NUMEROS.anchoItem }, 400, function() {
96            NUMEROS.seleccionado++;
97            NUMEROS.moviendo = false;
98          });
99        }
100      } 
101    }
102  }
103
104};
105
106
107
108
109var SUSCRIBIRSE = {
110
111  inicio : function() {
112    $('#menu .boletin button').on('click', function() {
113      $('#suscribirse-boletin').toggleClass('activo');
114      if ($('#suscribirse-boletin').hasClass('activo')) {
115        $('#email-boletin').focus();
116      }
117    });
118    $('#suscribirse-boletin form').on('submit', function() {
119      return SUSCRIBIRSE.validar($(this),'header');
120    });
121    $('#footer form').on('submit', function() {
122      return SUSCRIBIRSE.validar($(this),'footer');
123    });
124  },
125
126  validar : function(formulario,donde) {
127    if (!formulario.find('input[type="checkbox"]').is(':checked')) {
128      alert('Debes aceptar nuestra política de privacidad para poder suscribirte');
129      return false;
130    } else {
131      ga('send', 'event', 'captacion', 'boletin', donde);
132      return true;
133    }
134  }
135
136}
137
138
139
140
141var ROTATIVO = {
142
143  inicio : function() {
144    if ($('#rotativo').length > 0) {
145      $('#rotativo ul').marquee({
146          duration: 15000,
147          gap: 0,
148          delayBeforeStart: 0,
149          direction: 'left',
150          duplicated: true,
151          pauseOnHover: true
152      });
153    }
154  }
155
156}
157
158
159
160
161var COOKIES = {
162
163  clave : null,
164  codigo : null,
165  contenedor : null,
166  lopd : false,
167
168  inicio : function() {
169    COOKIES.clave = 'UA-57673802-1';
170    COOKIES.codigo = "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '" + COOKIES.clave + "', 'auto');ga('send', 'pageview');</script>";
171    COOKIES.contenedor = $('#aviso-cookies');
172    console.log('COOKIES (Y,N): ' + $.cookie('lopd'));
173    if ($.cookie('lopd')) {
174      COOKIES.aceptar();
175    } else {
176      COOKIES.contenedor.addClass('mostrado').find('button').on('click', function() {
177        if (!COOKIES.lopd) {
178          COOKIES.aceptar();
179        }
180      });
181    }
182  },
183
184  aceptar : function() {
185    $.cookie('lopd', 'true', { expires: 360 });
186    //$.cookie('lopd', 'true');
187    COOKIES.lopd = true;
188    COOKIES.contenedor.removeClass('mostrado');
189  }
190
191};
192
193var LAYERCAFE = {
194
195  clave : null,
196  codigo : null,
197  contenedor : null,
198  lopd : false,
199
200  inicio : function() {
201    
202    LAYERCAFE.contenedor = $('#layer-cafe');
203    /*
204    console.log('LAYERCAFE (Y,N): ' + $.cookie('lopd'));
205    if ($.cookie('laycafe')) {
206      LAYERCAFE.aceptar();
207    } else {
208      LAYERCAFE.contenedor.addClass('mostradoAnuncio').find('button').on('click', function() {
209        if (!LAYERCAFE.lopd) {
210          LAYERCAFE.aceptar();
211        }
212      });
213    }
214    */
215    LAYERCAFE.contenedor.addClass('mostradoAnuncio').find('button').on('click', function() {
216                                        LAYERCAFE.aceptar();
217                        });
218
219  },
220
221  aceptar : function() {
222    $.cookie('laycafe', 'true' );
223    LAYERCAFE.lopd = true;
224    LAYERCAFE.contenedor.removeClass('mostradoAnuncio');
225  }
226
227};
228
229
230jQuery.fn.reset = function () {
231  $(this).each (function() {
232    this.reset();
233  });
234};
235
236
237
238
239window.addEventListener('resize', function() {
240  MOBILE.reposicionar();
241}, false);
242
243
244
245
246$(document).ready(function() {
247  $('form').reset();
248  MOBILE.inicio();
249  NUMEROS.inicio();
250  SUSCRIBIRSE.inicio();
251  ROTATIVO.inicio();
252  COOKIES.inicio();
253  LAYERCAFE.inicio();
254});
255
256//Funcion para rotar elementos
257(function($){
258    $.fn.extend({ 
259        rotaterator: function(options) {
260 
261            var defaults = {
262                fadeSpeed: 500,
263                pauseSpeed: 100,
264				child:null
265            };
266             
267            var options = $.extend(defaults, options);
268         
269            return this.each(function() {
270                  var o =options;
271                  var obj = $(this);                
272                  var items = $(obj.children(), obj);
273				  items.each(function() {$(this).hide();})
274				  if(!o.child){var next = $(obj).children(':first');
275				  }else{var next = o.child;
276				  }
277				  $(next).fadeIn(o.fadeSpeed, function() {
278						$(next).delay(o.pauseSpeed).fadeOut(o.fadeSpeed, function() {
279							var next = $(this).next();
280							if (next.length == 0){
281									next = $(obj).children(':first');
282							}
283							$(obj).rotaterator({child : next, fadeSpeed : o.fadeSpeed, pauseSpeed : o.pauseSpeed});
284						})
285					});
286            });
287        }
288    });
289})(jQuery);
290
291$(document).ready(function() {
292    $('#rotate').rotaterator({fadeSpeed:500, pauseSpeed:5000});
293});

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.