PageSourceSearch

https://cofzamora.es/themes/custom/jango/js/drupal.js?v=1.x

js cofzamora.es collected 2026-10-03 00:26:48 UTC 110,731 bytes, 2,693 lines download raw bytes

1(function() {
2
3    var $ = jQuery;
4    var table = null;
5    var table2 = null;
6    var table3 = null;
7
8
9
10
11
12    function format(d) { //EL DETALLE DE MEDICAMENTOS
13        if (d != null) {
14            if (d.precio_menor_nacional != 'NO TIENE' && d.precio_menor_nacional.indexOf("€") == -1) {
15                d.precio_menor_nacional += ' €';
16            }
17
18            if (d.aportacion == 'ESPECIAL') {
19                d.aportacion = "REDUCIDA";
20            }
21
22            if (d.fecha_baja != "") {
23                return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
24                    '<tr>' +
25                    '<td style="font-weight:bold;">Código nacional:</td>' +
26                    '<td>' + d.codigo_nacional + '</td>' +
27                    '</tr>' +
28                    '<tr>' +
29                    '<td style="font-weight:bold;">Presentación:</td>' +
30                    '<td>' + d.nombre + '</td>' +
31                    '</tr>' +
32                    '<tr>' +
33                    '<td style="font-weight:bold;">EFG</td>' +
34                    '<td>' + d.efg + '</td>' +
35                    '</tr>' +
36                    '<tr>' +
37                    '<td style="font-weight:bold;">Aportación:</td>' +
38                    '<td>' + d.aportacion + '</td>' +
39                    '</tr>' +
40                    '<tr>' +
41                    '<td style="font-weight:bold;">Estado:</td>' +
42                    '<td>' + d.estado + '</td>' +
43                    '</tr>' +
44                    '<tr>' +
45                    '<td style="font-weight:bold;">Visado:</td>' +
46                    '<td>' + d.visado + '</td>' +
47                    '</tr>' +
48                    '<tr>' +
49                    '<td style="font-weight:bold;">Precio de facturación:</td>' +
50                    '<td>' + d.precio_facturacion + ' €</td>' +
51                    '</tr>' +
52                    '<tr>' +
53                    '<td style="font-weight:bold;">Precio Menor Nacional:</td>' +
54                    '<td>' + d.precio_menor_nacional + '</td>' +
55                    '</tr>' +
56                    '<tr>' +
57                    '<td style="font-weight:bold;">Fecha de baja:</td>' +
58                    '<td>' + d.fecha_baja + '</td>' +
59                    '</tr>' +
60                    '<tr>' +
61                    '<td style="font-weight:bold;">Importación paralela:</td>' +
62                    '<td>' + d.importacion_paralela + '</td>' +
63                    '</tr>' +
64                    '</table>';
65            } else {
66                return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
67                    '<tr>' +
68                    '<td style="font-weight:bold;">Código nacional:</td>' +
69                    '<td >' + d.codigo_nacional + '</td>' +
70                    '</tr>' +
71                    '<tr>' +
72                    '<td style="font-weight:bold;">Presentación:</td>' +
73                    '<td>' + d.nombre + '</td>' +
74                    '</tr>' +
75                    '<tr>' +
76                    '<td style="font-weight:bold;">EFG</td>' +
77                    '<td>' + d.efg + '</td>' +
78                    '</tr>' +
79                    '<tr>' +
80                    '<td style="font-weight:bold;">Aportación:</td>' +
81                    '<td>' + d.aportacion + '</td>' +
82                    '</tr>' +
83                    '<tr>' +
84                    '<td style="font-weight:bold;">Estado:</td>' +
85                    '<td>' + d.estado + '</td>' +
86                    '</tr>' +
87                    '<tr>' +
88                    '<td style="font-weight:bold;">Visado:</td>' +
89                    '<td>' + d.visado + '</td>' +
90                    '</tr>' +
91                    '<tr>' +
92                    '<td style="font-weight:bold;">Precio de facturación:</td>' +
93                    '<td>' + d.precio_facturacion + ' €</td>' +
94                    '</tr>' +
95                    '<tr>' +
96                    '<td style="font-weight:bold;">Precio Menor Nacional:</td>' +
97                    '<td>' + d.precio_menor_nacional + '</td>' +
98                    '</tr>' +
99                    '<tr>' +
100                    '<td style="font-weight:bold;">Importación paralela:</td>' +
101                    '<td>' + d.importacion_paralela + '</td>' +
102                    '</tr>' +
103                    '</table>';
104            }
105            // `d` is the original data object for the row
106
107        }
108    }
109
110    function format2(d) { //EL DETALLE DE PRINCIPIOS ACTIVOS
111        if (d != null) {
112            var fullInfo = d.detalle;
113            var arrayPrincipiosActivos = fullInfo.split("****");
114
115
116            var cabecera = "<table cellpadding='5' cellspacing='0' border='0' style='width: 100%; margin: 20px 0;'><tr style='color: white; background-color: green;'><td>Código Nacional</td><td>Presentación</td><td>PVP</td><td>Indicador EFG</td><td>Financiable</td></tr>"
117            var tablaDetalleTotal = cabecera;
118            for (i = 0; i < arrayPrincipiosActivos.length; i++) {
119                var elemento = arrayPrincipiosActivos[i].split("//")
120
121                if (elemento[2] == "") {
122                    elemento[2] = "0.00 €"
123                }
124
125                var noFinanciable = false;
126                if (elemento[4] == "N") {
127                    noFinanciable = true;
128                }
129                if (noFinanciable) {
130                    var cuerpo = "<tr style='color:red'><td style='width: 15%;'>" + elemento[0] + "</td><td style='width: 50%;'>" + elemento[1] + "</td><td style='width: 15%;'>" + elemento[2] + "</td><td style='width: 15%;'>" + elemento[3] + "</td><td style='width: 15%;'>" + elemento[4];
131                } else {
132                    var cuerpo = "<tr><td style='width: 15%;'>" + elemento[0] + "</td><td style='width: 50%;'>" + elemento[1] + "</td><td style='width: 15%;'>" + elemento[2] + "</td><td style='width: 15%;'>" + elemento[3] + "</td><td style='width: 15%;'>" + elemento[4];
133                }
134
135                tablaDetalleTotal = tablaDetalleTotal + cuerpo;
136            }
137
138        }
139        // `d` is the original data object for the row
140        return tablaDetalleTotal;
141    }
142
143    function format3(d) { //EL DETALLE DE LOS DIETOTERAPICOS
144        // `d` is the original data object for the row
145        return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
146            '<tr>' +
147            '<td style="font-weight:bold;">Código nacional:</td>' +
148            '<td>' + d.codigo + '</td>' +
149            '</tr>' +
150            '<tr>' +
151            '<td style="font-weight:bold;">Nombre:</td>' +
152            '<td>' + d.nombre + '</td>' +
153            '</tr>' +
154            '<tr>' +
155            '<td style="font-weight:bold;">PMF:</td>' +
156            '<td>' + d.pmf + '</td>' +
157            '</tr>' +
158            '<tr>' +
159            '<td style="font-weight:bold;">Estado:</td>' +
160            '<td>' + d.situacion + '</td>' +
161            '</tr>' +
162            '<td style="font-weight:bold;">Laboratorio:</td>' +
163            '<td>' + d.laboratorio + '</td>' +
164            '</tr>' +
165            '</table>';
166    }
167
168
169
170    /*function format ( d ) {
171      return 'Full name: '+d.efg+' '+d.aportacion+'<br>'+
172        'Salary: '+d.estado+'<br>'+
173        'The child row can contain any data you wish, including links, images, inner tables etc.';
174    }*/
175
176    function setRojobtnaccordion(){
177        $(".btn-accordion").each(function( index ) {
178            let elemento = $(this);
179            if(elemento.attr('href') !== undefined && elemento.attr('href').trim() !== ""){
180                $(this).css('background-color', '#2f9b13');
181            }else{
182                $(this).css('background-color', 'red');
183            }
184        })
185    }
186
187
188    $(document).ready(function() {
189
190        setRojobtnaccordion();
191       
192        const btnVolver = document.getElementsByClassName('btn-volver');
193        if(btnVolver !== 'undefined' && btnVolver.length > 0){
194            btnVolver[0].href = "javascript:history.back()";
195        }
196
197        var URLactual = window.location;
198
199        var divTituloFarmacia = $('.tituloFarmacia h3 span');
200        divTituloFarmacia.html(divTituloFarmacia.text().replace(/(\w+?)$/, '<span class="spanTituloIndexFarmacia">$1</span>'));
201        $(".spanTituloIndexFarmacia").css("color", "green");
202
203
204        //quitando es de la url (el idioma)
205
206        // if( URLactual.toString().indexOf('/es/buscador-principios_activos')!=-1 ||
207        // URLactual.toString().indexOf('/es/buscador-medicamentos')!=-1 ||
208        // URLactual.toString().indexOf('/es/buscador_dietoterapicos')!=-1   ){
209
210        //   var nuevaURL = URLactual.toString().replace("/es", "");
211        //   location.href =nuevaURL;
212        // }
213        isMobile = false;
214        if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) ||
215            /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
215sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4))) {
216            isMobile = true;
217        }
218
219        if (isMobile) {
220            //$(".c-navbar-wrapper > div.c-brand").html("<a href='http://10.10.10.142/es' class='c-logo2'><img src='/sites/default/files/img/letrasLogotipo.png' alt='Colegio de Farmacéuticos de Zamora' class='c-desktop-logo2'></a><button class='c-hor-nav-toggler' type='button' data-target='.c-mega-menu'><span class='c-line'></span><span class='c-line'></span><span class='c-line'></span></button><button class='c-topbar-toggler' type='button'><i class='fa fa-ellipsis-v'></i></button><button class='c-search-toggler' type='button'><i class='fa fa-search'></i></button>");
221            if ($(".logotipoLetrasEnlace").length == 0) { //si no hay ningun div aun de letras de logotipo
222                $('.c-logo').hide(); //se esconde el logotipo original
223                //se añade el logotipo de letras
224                $(".c-navbar-wrapper").prepend("<div class='contenedorImagenLogotipo'><a href='/'><img src='/sites/default/files/img/letrasLogotipo.png' alt='Colegio de Farmacéuticos de Zamora' class='c-desktop-logo logotipoLetrasEnlace'></img></a></div>");
225                $(".c-navbar-wrapper").css("display", "flex");
226                $(".c-mega-menu").css("margin-left", "auto");
227                $(".divNombreUsuarioHeader").css("top", "6px");
228            } else { //si si que está el logotipo de letras de logotipo
229                $('.c-logo').hide();
230                $('.contenedorImagenLogotipo').show();
231                $(".c-navbar-wrapper").css("display", "flex");
232                $(".c-navbar-wrapper").css("align-items", "center");
233                $(".c-mega-menu").css("margin-left", "auto");
234                $(".divNombreUsuarioHeader").css("top", "6px");
235            }
236
237        } else { //si se esta en el top
238            $('.c-logo').show();
239            $('.contenedorImagenLogotipo').remove();
240            $(".c-navbar-wrapper").css("display", "block");
241            $(".divNombreUsuarioHeader").css("top", "18px");
242            //$(".c-logo > img").css("margin-left", "10px");
243
244        }
245
246        $(window).scroll(function() {
247            if (!isMobile) {
248                var height = $(window).scrollTop();
249
250                if (height > 81) { //altura a la que hay que cambiar la imagen
251
252                    //$(".c-navbar-wrapper > div.c-brand").html("<a href='http://10.10.10.142/es' class='c-logo2'><img src='/sites/default/files/img/letrasLogotipo.png' alt='Colegio de Farmacéuticos de Zamora' class='c-desktop-logo2'></a><button class='c-hor-nav-toggler' type='button' data-target='.c-mega-menu'><span class='c-line'></span><span class='c-line'></span><span class='c-line'></span></button><button class='c-topbar-toggler' type='button'><i class='fa fa-ellipsis-v'></i></button><button class='c-search-toggler' type='button'><i class='fa fa-search'></i></button>");
253                    if ($(".logotipoLetrasEnlace").length == 0) { //si no hay ningun div aun de letras de logotipo
254                        $('.c-logo').hide(); //se esconde el logotipo original
255                        //se añade el logotipo de letras
256                        $(".c-navbar-wrapper").prepend("<div class='contenedorImagenLogotipo'><a href='/'><img src='/sites/default/files/img/letrasLogotipo.png' alt='Colegio de Farmacéuticos de Zamora' class='c-desktop-logo logotipoLetrasEnlace'></img></a></div>");
257                        $(".c-navbar-wrapper").css("display", "flex");
258                        $(".c-mega-menu").css("margin-left", "auto");
259                        $(".divNombreUsuarioHeader").css("top", "6px");
260                    } else { //si si que está el logotipo de letras de logotipo
261                        $('.c-logo').hide();
262                        $('.contenedorImagenLogotipo').show();
263                        $(".c-navbar-wrapper").css("display", "flex");
264                        $(".c-navbar-wrapper").css("align-items", "center");
265                        $(".c-mega-menu").css("margin-left", "auto");
266                        $(".divNombreUsuarioHeader").css("top", "6px");
267                    }
268
269                } else { //si se esta en el top
270                    $('.c-logo').show();
271                    $('.contenedorImagenLogotipo').remove();
272                    $(".c-navbar-wrapper").css("display", "block");
273                    $(".divNombreUsuarioHeader").css("top", "18px");
274                    //$(".c-logo > img").css("margin-left", "10px");
275                }
276            }
277
278
279        });
280
281
282
283
284        //$('#tabla_medicamentos').DataTable();
285
286        var tablaMedicamentos = document.getElementById("tabla_medicamentos");
287        if (tablaMedicamentos != null) {
288
289            table = $('#tabla_medicamentos').DataTable({
290                //"ajax": "objects.txt",
291                //dom: 'Blfrtip',
292                //"processing": true,
293                //"serverSide": true,
294                //"ajax": "procesar-medicamentos.php",
295                "ajax": {
296                    "url": "/procesar-medicamentos.php",
297                    "type": "POST"
298                },
299                //"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],	
300                "columns": [{
301                        "class": "details-control",
302                        "orderable": false,
303                        "data": null,
304                        "defaultContent": ""
305                    },
306                    { "data": "codigo_nacional" },
307                    { "data": "nombre" }
308                ],
309                "language": {
310                    buttons: {
311                        // copy: 'Copiar',
312                        // copyTitle: 'Copia en el portapapeles',
313                        // copySuccess: {
314                        //   _: '%d lineas copiadas',
315                        //   1: '1 linea copiada'
316                        // },
317                        // print: 'Imprimir',
318                    },
319                    "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
320                    "sZeroRecords": "No se ha encontrado ningun resultado",
321                    "sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
322                    "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
323                    "oPaginate": {
324                        "sFirst": "Primero",
325                        "sLast": "Último",
326                        "sNext": "Siguiente",
327                        "sPrevious": "Anterior"
328                    },
329                },
330
331                "order": [
332                    [1, 'asc']
333                ]
334            });
335
336            var detailRows = [];
337
338            $('#tabla_medicamentos tbody').on('click', 'tr', function() {
339                var tr = $(this).closest('tr');
340                var row = table.row(tr);
341                var idx = $.inArray(tr.attr('id'), detailRows);
342
343                if (row.child.isShown()) {
344                    tr.removeClass('details');
345                    row.child.hide();
346
347                    // Remove from the 'open' array
348                    detailRows.splice(idx, 1);
349                } else {
350                    tr.addClass('details');
351                    if (row.child(format(row.data())) != null)
352                        row.child(format(row.data())).show();
353
354                    // Add to the 'open' array
355                    if (idx === -1) {
356                        detailRows.push(tr.attr('id'));
357                    }
358                }
359            });
360
361            table.on('draw', function() {
362                $.each(detailRows, function(i, id) {
363                    $('#' + id + ' td.details-control').trigger('click');
364                });
365            });
366
367        }
368
369
370
371
372
373        // Add event listener for opening and closing details
374        /* $('#example tbody').on('click', 'td.details-control', function () {
375       var tr = $(this).closest('tr');
376       var row = table.row( tr );
377
378       if ( row.child.isShown() ) {
379           // This row is already open - close it
380           row.child.hide();
381           tr.removeClass('shown');
382       }
383       else {
384           // Open this row
385           row.child( format(row.data()) ).show();
386           tr.addClass('shown');
387       }
388   } );*/
389
390
391
392        var tablaPrincipiosActivos = document.getElementById("tabla_principios_activos");
393
394        if (tablaPrincipiosActivos != null) {
395            //$('#tabla_principios_activos').DataTable();
396            table2 = $('#tabla_principios_activos').DataTable({
397                //"ajax": "objects.txt",
398                //dom: 'Blfrtip',
399                //"processing": true,
400                //"serverSide": true,
401                //"ajax": "procesar-principios-activos.php",
402                "ajax": {
403                    "url": "/procesar-principios-activos.php",
404                    "type": "POST"
405                },
406                //"deferLoading": 0,
407                //"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],	
408                "columns": [{
409                        "class": "details-control",
410                        "orderable": false,
411                        "data": null,
412                        "defaultContent": ""
413                    },
414                    { "data": "codigo_general" },
415                    { "data": "nombre_general" },
416                    { "data": "pvp_general" },
417                    { "data": "cod_nacional_concat" },
418                    { "data": "detalle" }
419                ],
420
421                "language": {
422                    buttons: {
423                        // copy: 'Copiar',
424                        // copyTitle: 'Copia en el portapapeles',
425                        // copySuccess: {
426                        //   _: '%d lineas copiadas',
427                        //   1: '1 linea copiada'
428                        // },
429                        // print: 'Imprimir',
430                    },
431                    "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
432                    "sZeroRecords": "No se ha encontrado ningun resultado",
433                    "sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
434                    "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
435                    "oPaginate": {
436                        "sFirst": "Primero",
437                        "sLast": "Último",
438                        "sNext": "Siguiente",
439                        "sPrevious": "Anterior"
440                    },
441
442                },
443
444                "order": [
445                    [1, 'asc']
446                ]
447            });
448
449            var detailRows = [];
450
451            $('#tabla_principios_activos tbody').on('click', 'tr', function() {
452                var tr = $(this).closest('tr');
453                var row = table2.row(tr);
454                var idx = $.inArray(tr.attr('id'), detailRows);
455
456                if (row.child.isShown()) {
457                    tr.removeClass('details');
458                    row.child.hide();
459
460                    // Remove from the 'open' array
461                    detailRows.splice(idx, 1);
462                } else {
463                    tr.addClass('details');
464                    if (row.child(format2(row.data())) != null)
465                        row.child(format2(row.data())).show();
466
467                    // Add to the 'open' array
468                    if (idx === -1) {
469                        detailRows.push(tr.attr('id'));
470                    }
471                }
472            });
473
474            table2.on('draw', function() {
475                $.each(detailRows, function(i, id) {
476                    $('#' + id + ' td.details-control').trigger('click');
477                });
478            });
479        }
480
481
482        var tablaDietoterapicos = document.getElementById("tabla_dietoterapicos");
483
484        if (tablaDietoterapicos != null) {
485            //$('#tabla_principios_activos').DataTable();
486            table3 = $('#tabla_dietoterapicos').DataTable({
487                //"ajax": "objects.txt",
488                //dom: 'Blfrtip',
489                "processing": true,
490                "serverSide": true,
491                //"ajax": "procesar-principios-activos.php",
492                "ajax": {
493                    "url": "/procesar-dietoterapicos.php",
494                    "type": "POST"
495                },
496                "deferLoading": 0,
497                //"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],	
498                "columns": [{
499                        "class": "details-control",
500                        "orderable": false,
501                        "data": null,
502                        "defaultContent": ""
503                    },
504                    { "data": "codigo" },
505                    { "data": "nombre" },
506                    { "data": "pmf" },
507                    { "data": "situacion" },
508                    { "data": "laboratorio" },
509                    { "data": "formula" },
510                ],
511
512                "language": {
513                    buttons: {
514                        // copy: 'Copiar',
515                        // copyTitle: 'Copia en el portapapeles',
516                        // copySuccess: {
517                        //   _: '%d lineas copiadas',
518                        //   1: '1 linea copiada'
519                        // },
520                        // print: 'Imprimir',
521                    },
522                    "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
523                    "sZeroRecords": "No se ha encontrado ningun resultado",
524                    "sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
525                    "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
526                    "oPaginate": {
527                        "sFirst": "Primero",
528                        "sLast": "Último",
529                        "sNext": "Siguiente",
530                        "sPrevious": "Anterior"
531                    },
532
533                },
534
535                "order": [
536                    [1, 'asc']
537                ]
538            });
539
540            var detailRows = [];
541
542            $('#tabla_dietoterapicos tbody').on('click', 'tr', function() {
543                var tr = $(this).closest('tr');
544                var row = table3.row(tr);
545                var idx = $.inArray(tr.attr('id'), detailRows);
546
547                // if ( row.child.isShown() ) {
548                //     tr.removeClass( 'details' );
549                //     row.child.hide();
550
551                //     // Remove from the 'open' array
552                //     detailRows.splice( idx, 1 );
553                // }
554                // else {
555                //     tr.addClass( 'details' );
556                //     row.child( format3( row.data() ) ).show();
557
558                //     // Add to the 'open' array
559                //     if ( idx === -1 ) {
560                //         detailRows.push( tr.attr('id') );
561                //     }
562                // }
563            });
564
565            //Detalle de la tabla
566
567            table3.on('draw', function() {
568                $.each(detailRows, function(i, id) {
569                    $('#' + id + ' td.details-control').trigger('click');
570                });
571
572            });
573
574        }
575
576
577        // Add event listener for opening and closing details
578        /* $('#tabla_principios_activos tbody').on('click', 'td.details-control', function () {
579        var tr = $(this).closest('tr');
580        var row = table.row( tr );
581  
582        if ( row.child.isShown() ) {
583            // This row is already open - close it
584            row.child.hide();
585            tr.removeClass('shown');
586        }
587        else {
588            // Open this row
589            row.child( format(row.data()) ).show();
590            tr.addClass('shown');
591        }
592      } );*/
593
594        function filtrarTablaPrincipiosActivos() {
595
596            var frmCodigo = $("#frmCodigo").val();
597            var columna = "1";
598            table2.columns(columna).search(frmCodigo);
599
600
601            var frmGrupo = $("#frmGrupo").val();
602            var columna = "2";
603            table2.columns(columna).search(frmGrupo);
604
605            var frmCodigoNacional = $("#frmCodigoNacional").val();
606            var columna = "4";
607            table2.columns(columna).search(frmCodigoNacional);
608
609            table2.draw();
610        }
611
612        function filtrarTablaMedicamentos() {
613
614            var frmCodigo = $("#frmCodigo").val();
615            var columna = "1";
616            table.columns(columna).search(frmCodigo);
617
618            var frmNombre = $("#frmNombre").val();
619            var columna = "2";
620            table.columns(columna).search(frmNombre);
621
622            table.draw();
623        }
624
625        function filtrarTablaDietoterapicos() {
626
627            var frmNombreDieto = $("#frmNombreDieto").val();
628            var columna = "2";
629            table3.columns(columna).search(frmNombreDieto);
630
631
632
633            var frmCodigoDieto = $("#frmCodigoDieto").val();
634            var columna = "1";
635            table3.columns(columna).search(frmCodigoDieto);
636
637            var frmFormulaDieto = $("#selectFormulas").val();
638            var columna = "6";
639            if (frmFormulaDieto != "NULL")
640                table3.columns(columna).search(frmFormulaDieto);
641            else
642                table3.columns(columna).search("");
643
644
645            table3.draw();
646
647
648        }
649
650        //quitando el not show again del modal
651        $(".modal-page-footer").innerHTML = "";
652
653
654
655        if (URLactual.toString().indexOf('buscador_dietoterapicos') != -1) {
656
657
658
659            $(function() {
660
661                $('#tabla_dietoterapicos').on('draw.dt', function() {
662
663                    $('#tabla_dietoterapicos tbody tr').each(function() {
664
665                        if ($(this.children).length > 1 && $(this.children[0]).text() !== 'No se ha encontrado ningun resultado') {
666                            var estado = ($(this.children[4].childNodes[0]).text());
667                            if (estado == "BAJA") {
668                                $(this).css('color', ' red');
669                                $(this).css('font-weight', ' bold');
670                            } else {
671                                $(this).css('color', ' green');
672                                $(this).css('font-weight', ' bold');
673                            }
674                        }
675
676
677
678                    });
679
680                });
681
682
683
684                $("#tabla_dietoterapicos_wrapper").css("padding-top", "25px");
685                $("#tabla_dietoterapicos_length").css("display", "none");
686                $("#tabla_dietoterapicos_filter").css("display", "none");
687
688                //quitando la columna código nacional - cuarta columna
689                $("#tabla_dietoterapicos > tbody").css("display", "none");
690                $("#tabla_dietoterapicos_paginate").css("display", "none");
691                $("#tabla_dietoterapicos_info").css("display", "none");
692
693                $('#tabla_dietoterapicos_filter > label > input').attr('id', 'buscadorDietoterapicosGlobal');
694                //$('#buscadorDietoterapicos').bind('onchange', 'alert("hola")');
695
696                var flagBuscadorGlobal_Dieto = false;
697                var flagBuscadorCodigo_Dieto = false;
698                var flagBuscadorNombre_Dieto = false;
699                var flagBuscadorFormula_Dieto = false;
700
701                $('#buscadorDietoterapicosGlobal').bind('input', function() {
702
703                    if ($(this).val().length < 3) {
704                        flagBuscadorGlobal_Dieto = false;
705                    } else {
706                        flagBuscadorGlobal_Dieto = true;
707                    }
708
709                    if (flagBuscadorGlobal_Dieto || flagBuscadorCodigo_Dieto || flagBuscadorNombre_Dieto || flagBuscadorFormula_Dieto) {
710                        $("#tabla_dietoterapicos > tbody").css("display", "table-row-group");
711                        $("#tabla_dietoterapicos_paginate").css("display", "block");
712                        $("#tabla_dietoterapicos_info").css("display", "block");
713                    } else {
714                        $("#tabla_dietoterapicos > tbody").css("display", "none");
715                        $("#tabla_dietoterapicos_paginate").css("display", "none");
716                        $("#tabla_dietoterapicos_info").css("display", "none");
717                    }
718
719                    $(this).blur();
720                    $(this).focus();
721                });
722
723                $('#frmCodigoDieto').bind('input', function() {
724
725                    if ($(this).val().length < 3) {
726                        flagBuscadorCodigo_Dieto = false;
727                    } else {
728                        flagBuscadorCodigo_Dieto = true;
729                    }
730
731                    if (flagBuscadorGlobal_Dieto || flagBuscadorCodigo_Dieto || flagBuscadorNombre_Dieto || flagBuscadorFormula_Dieto) {
732                        $("#tabla_dietoterapicos > tbody").css("display", "table-row-group");
733                        $("#tabla_dietoterapicos_paginate").css("display", "block");
734                        $("#tabla_dietoterapicos_info").css("display", "block");
735                    } else {
736                        $("#tabla_dietoterapicos > tbody").css("display", "none");
737                        $("#tabla_dietoterapicos_paginate").css("display", "none");
738                        $("#tabla_dietoterapicos_info").css("display", "none");
739                    }
740
741                    $(this).blur();
742                    $(this).focus();
743
744                });
745
746                $('#frmNombreDieto').bind('input', function() {
747
748                    if ($(this).val().length < 3) {
749                        flagBuscadorNombre_Dieto = false;
750                    } else {
751                        flagBuscadorNombre_Dieto = true;
752                    }
753
754                    if (flagBuscadorGlobal_Dieto || flagBuscadorCodigo_Dieto || flagBuscadorNombre_Dieto || flagBuscadorFormula_Dieto) {
755                        $("#tabla_dietoterapicos > tbody").css("display", "table-row-group");
756                        $("#tabla_dietoterapicos_paginate").css("display", "block");
757                        $("#tabla_dietoterapicos_info").css("display", "block");
758                    } else {
759                        $("#tabla_dietoterapicos > tbody").css("display", "none");
760                        $("#tabla_dietoterapicos_paginate").css("display", "none");
761                        $("#tabla_dietoterapicos_info").css("display", "none");
762                    }
763
764                    $(this).blur();
765                    $(this).focus();
766                });
767
768                $("#selectFormulas").change(function() {
769
770                    if ($(this).val() == "NULL") {
771                        flagBuscadorFormula_Dieto = false;
772                    } else {
773                        flagBuscadorFormula_Dieto = true;
774                    }
775
776                    if (flagBuscadorGlobal_Dieto || flagBuscadorCodigo_Dieto || flagBuscadorNombre_Dieto || flagBuscadorFormula_Dieto) {
777                        $("#tabla_dietoterapicos > tbody").css("display", "table-row-group");
778                        $("#tabla_dietoterapicos_paginate").css("display", "block");
779                        $("#tabla_dietoterapicos_info").css("display", "block");
780                    } else {
781                        $("#tabla_dietoterapicos > tbody").css("display", "none");
782                        $("#tabla_dietoterapicos_paginate").css("display", "none");
783                        $("#tabla_dietoterapicos_info").css("display", "none");
784                    }
785
786                    $(this).blur();
787                    $(this).focus();
788                });
789
790
791            });
792
793
794            $("#frmCodigoDieto").off("keyup");
795            $("#frmCodigoDieto").off("change");
796            $("#frmCodigoDieto").on("keyup", filtrarTablaDietoterapicos);
797            $("#frmCodigoDieto").on("change", filtrarTablaDietoterapicos);
798
799            $("#frmNombreDieto").off("keyup");
800            $("#frmNombreDieto").off("change");
801            $("#frmNombreDieto").on("keyup", filtrarTablaDietoterapicos);
802            $("#frmNombreDieto").on("change", filtrarTablaDietoterapicos);
803
804            $("#selectFormulas").off("keyup");
805            $("#selectFormulas").off("change");
806            $("#selectFormulas").on("keyup", filtrarTablaDietoterapicos);
807            $("#selectFormulas").on("change", filtrarTablaDietoterapicos);
808
809
810
811
812        }
813
814        if (URLactual.toString().indexOf('buscador-principios_activos') != -1) {
815
816
817            $('#tabla_principios_activos').on('draw.dt', function() {
818
819
820                $('#tabla_principios_activos tbody tr').each(function() {
821
822                    $(this).css('font-weight', ' bold');
823                    //$(this).css('text-align',' center');
824
825                });
826
827                $('#tabla_principios_activos tbody tr td:nth-child(4)').each(function() {
828
829                    $(this).css('text-decoration', ' underline');
830                    //$(this).css('text-align',' center');
831
832                });
833
834
835            });
836
837
838
839
840            $("#tabla_principios_activos_wrapper").css("padding-top", "50px");
841            $("#tabla_principios_activos_length").css("display", "none");
842            $("#tabla_principios_activos_filter").css("display", "none");
843
844            //quitando la columna código nacional - cuarta columna
845
846
847            $("#tabla_principios_activos > tbody").css("display", "none");
848            $("#tabla_principios_activos_paginate").css("display", "none");
849            $("#tabla_principios_activos_info").css("display", "none");
850
851            $('#tabla_principios_activos_filter > label > input').attr('id', 'buscadorPrincipiosActivosGlobal');
852            //$('#buscadorDietoterapicos').bind('onchange', 'alert("hola")');
853
854            var flagBuscadorGlobal_PP = false;
855            var flagBuscadorCodigo_PP = false;
856            var flagBuscadorGrupo_PP = false;
857            var flagBuscadorCodigoNacional_PP = false;
858
859            $('#buscadorPrincipiosActivosGlobal').bind('input', function() {
860
861                if ($(this).val().length < 3) {
862                    flagBuscadorGlobal_PP = false;
863                } else {
864                    flagBuscadorGlobal_PP = true;
865                }
866
867                if (flagBuscadorGlobal_PP || flagBuscadorCodigo_PP || flagBuscadorGrupo_PP || flagBuscadorCodigoNacional_PP) {
868                    $("#tabla_principios_activos > tbody").css("display", "table-row-group");
869                    $("#tabla_principios_activos_paginate").css("display", "block");
870                    $("#tabla_principios_activos_info").css("display", "block");
871                } else {
872                    $("#tabla_principios_activos > tbody").css("display", "none");
873                    $("#tabla_principios_activos_paginate").css("display", "none");
874                    $("#tabla_principios_activos_info").css("display", "none");
875                }
876
877                $(this).blur();
878                $(this).focus();
879            });
880
881            $('#frmCodigo').bind('input', function() {
882
883                if ($(this).val().length < 3) {
884                    flagBuscadorCodigo_PP = false;
885                } else {
886                    flagBuscadorCodigo_PP = true;
887                }
888
889                if (flagBuscadorGlobal_PP || flagBuscadorCodigo_PP || flagBuscadorGrupo_PP || flagBuscadorCodigoNacional_PP) {
890                    $("#tabla_principios_activos > tbody").css("display", "table-row-group");
891                    $("#tabla_principios_activos_paginate").css("display", "block");
892                    $("#tabla_principios_activos_info").css("display", "block");
893                } else {
894                    $("#tabla_principios_activos > tbody").css("display", "none");
895                    $("#tabla_principios_activos_paginate").css("display", "none");
896                    $("#tabla_principios_activos_info").css("display", "none");
897                }
898
899                $(this).blur();
900                $(this).focus();
901            });
902
903            $('#frmGrupo').bind('input', function() {
904
905                if ($(this).val().length < 3) {
906                    flagBuscadorGrupo_PP = false;
907                } else {
908                    flagBuscadorGrupo_PP = true;
909                }
910
911                if (flagBuscadorGlobal_PP || flagBuscadorCodigo_PP || flagBuscadorGrupo_PP || flagBuscadorCodigoNacional_PP) {
912                    $("#tabla_principios_activos > tbody").css("display", "table-row-group");
913                    $("#tabla_principios_activos_paginate").css("display", "block");
914                    $("#tabla_principios_activos_info").css("display", "block");
915                } else {
916                    $("#tabla_principios_activos > tbody").css("display", "none");
917                    $("#tabla_principios_activos_paginate").css("display", "none");
918                    $("#tabla_principios_activos_info").css("display", "none");
919                }
920
921                $(this).blur();
922                $(this).focus();
923            });
924
925            $('#frmCodigoNacional').bind('input', function() {
926
927                if ($(this).val().length < 3) {
928                    flagBuscadorCodigoNacional_PP = false;
929                } else {
930                    flagBuscadorCodigoNacional_PP = true;
931                }
932
933                if (flagBuscadorGlobal_PP || flagBuscadorCodigo_PP || flagBuscadorGrupo_PP || flagBuscadorCodigoNacional_PP) {
934                    $("#tabla_principios_activos > tbody").css("display", "table-row-group");
935                    $("#tabla_principios_activos_paginate").css("display", "block");
936                    $("#tabla_principios_activos_info").css("display", "block");
937                } else {
938                    $("#tabla_principios_activos > tbody").css("display", "none");
939                    $("#tabla_principios_activos_paginate").css("display", "none");
940                    $("#tabla_principios_activos_info").css("display", "none");
941                }
942
943                $(this).blur();
944                $(this).focus();
945            });
946
947
948
949
950
951            $("#frmCodigo").off("keyup");
952            $("#frmCodigo").off("change");
953            $("#frmCodigo").on("keyup", filtrarTablaPrincipiosActivos);
954            $("#frmCodigo").on("change", filtrarTablaPrincipiosActivos);
955
956            $("#frmGrupo").off("keyup");
957            $("#frmGrupo").off("change");
958            $("#frmGrupo").on("keyup", filtrarTablaPrincipiosActivos);
959            $("#frmGrupo").on("change", filtrarTablaPrincipiosActivos);
960
961            $("#frmCodigoNacional").off("keyup");
962            $("#frmCodigoNacional").off("change");
963            $("#frmCodigoNacional").on("keyup", filtrarTablaPrincipiosActivos);
964            $("#frmCodigoNacional").on("change", filtrarTablaPrincipiosActivos);
965
966
967
968        }
969
970        // $('tr.filaFarmacia').each(function () {
971
972        // console.log($(this.cells[0]).text().trim());
973        //   var filaFarmaciaGuardia = $(this.cells[0]).text().trim();
974        //   if(filaFarmaciaGuardia == 'Zamora capital' || filaFarmaciaGuardia == 'Villalpando' || filaFarmaciaGuardia == 'Guareña'
975        //   || filaFarmaciaGuardia == 'Campos Lampreana' || filaFarmaciaGuardia == 'Toro'){
976        //       $( $(this) ).prependTo( ".cuerpoTablaFarmacias" );
977        //   }
978
979        // });
980
981
982        // var today = new Date();
983        // var horaActual = today.getHours() + ":" + today.getMinutes();
984        // if(horaActual < "10:00" || horaActual > "22:00"){
985
986        //       //para guareña
987        //       var table = document.getElementById("tablaPortadaGuardias");
988        //       if(table != null){
989        //             var row = table.insertRow(1);
990        //             row.style.border = 'none';
991        //             var cell1 = row.insertCell(0);
992        //             cell1.colSpan = "1";
993        //             cell1.innerHTML = "Guareña";
994        //             cell1.style.color = '#5C6873';
995        //             cell1.style.border = '1px solid';
996        //             cell1.style.borderColor = 'transparent';
997        //             cell1.style.fontSize = '15px';
998        //             cell1.style.fontWeight = 'normal';
999
1000        //             var cell2 = row.insertCell(1);
1001        //             cell2.colSpan = "3";
1002        //             cell2.innerHTML = "Los Servicios de Urgencias de Guareña están cubiertos por Zamora Capital y Toro";
1003        //             cell2.style.border = '1px solid';
1004        //             cell2.style.borderColor = 'transparent';
1005        //             cell2.style.color = '#5C6873';
1006        //             cell2.style.padding = '4px';
1007        //             cell2.style.fontSize = '15px';
1008        //             cell2.style.fontWeight = 'bold';
1009        //             cell2.style.verticalAlign = 'middle';
1010
1011        //             //para Campos Lampreana
1012        //             var table = document.getElementById("tablaPortadaGuardias");
1013        //             var row = table.insertRow(1);
1014        //             row.style.border = 'none';
1015        //             var cell1 = row.insertCell(0);
1016        //             cell1.colSpan = "1";
1017        //             cell1.innerHTML = "Campos Lampreana";
1018        //             cell1.style.color = '#5C6873';
1019        //             cell1.style.border = '1px solid';
1020        //             cell1.style.borderColor = 'transparent';
1021        //             cell1.style.fontSize = '15px';
1022        //             cell1.style.fontWeight = 'normal';
1023
1024        //             var cell2 = row.insertCell(1);
1025        //             cell2.colSpan = "3";
1026        //             cell2.innerHTML = "Los Servicios de Urgencias de Campos Lampreana están cubiertos por Zamora Capital y Benavente";
1027        //             cell2.style.border = '1px solid';
1028        //             cell2.style.borderColor = 'transparent';
1029        //             cell2.style.color = '#5C6873';
1030        //             cell2.style.padding = '4px';
1031        //             cell2.style.fontSize = '15px';
1032        //             cell2.style.fontWeight = 'bold';
1033        //             cell2.style.verticalAlign = 'middle';
1034
1035        //             //villapando
1036        //             var table = document.getElementById("tablaPortadaGuardias");
1037        //             var row = table.insertRow(1);
1038        //             row.style.border = 'none';
1039        //             var cell1 = row.insertCell(0);
1040        //             cell1.colSpan = "1";
1041        //             cell1.innerHTML = "Villalpando";
1042        //             cell1.style.color = '#5C6873';
1043        //             cell1.style.border = '1px solid';
1044        //             cell1.style.borderColor = 'transparent';
1045        //             cell1.style.fontSize = '15px';
1046        //             cell1.style.fontWeight = 'normal';
1047
1048        //             var cell2 = row.insertCell(1);
1049        //             cell2.colSpan = "3";
1050        //             cell2.innerHTML = "Los Servicios de Urgencias de Villalpando están cubiertos por Benavente";
1051        //             cell2.style.border = '1px solid';
1052        //             cell2.style.borderColor = 'transparent';
1053        //             cell2.style.color = '#5C6873';
1054        //             cell2.style.padding = '4px';
1055        //             cell2.style.fontSize = '15px';
1056        //             cell2.style.fontWeight = 'bold';
1057        //             cell2.style.verticalAlign = 'middle';
1058        //       }
1059
1060
1061
1062        // }
1063
1064
1065
1066        //       $('#tablaPortadaGuardias tr').each(function (index) {
1067
1068        //         var filaFarmaciaGuardia = $(this.cells[0]).text().trim();
1069
1070        //         if(filaFarmaciaGuardia == 'Villalpando'){
1071        //             console.log(index)
1072        //             var table = document.getElementById("tablaPortadaGuardias");
1073        //             var row = table.insertRow(index);
1074        //             row.style.border = 'none';
1075        //             var cell1 = row.insertCell(0);
1076        //             cell1.colSpan = "4";
1077        //             cell1.innerHTML = "Villalpando";
1078        //             cell1.style.color = 'red';
1079        //             cell1.style.fontWeight = 'bold';
1080        //             cell1.style.border = '1px solid';
1081        //             cell1.style.borderColor = 'transparent';
1082        //             cell1.style.fontSize = '20px';
1083
1084        //             var row2 = table.insertRow(index+1);
1085        //             row2.style.border = 'none';
1086        //             var cell1 = row2.insertCell(0);
1087        //             cell1.colSpan = "4";
1088        //             cell1.innerHTML = "SERVICIO NOCTURNO ( de 22.00 H. a 9.30 H. día siguiente) BENAVENTE";
1089        //             cell1.style.border = '1px solid';
1090        //             cell1.style.borderColor = 'transparent';
1091        //             cell1.style.fontWeight = 'bold';
1092        //             cell1.style.color = 'black';
1093        //             cell1.style.padding = '4px';
1094
1095        //         }
1096        //     });
1097
1098
1099        //     $('#tablaPortadaGuardias tr').each(function (index) {
1100
1101        //       var filaFarmaciaGuardia = $(this.cells[0]).text().trim();
1102
1103        //       if(filaFarmaciaGuardia == 'Toro'){
1104        //           console.log(index)
1105        //           var table = document.getElementById("tablaPortadaGuardias");
1106        //           var row = table.insertRow(index);
1107        //           row.style.border = 'none';
1108        //           var cell1 = row.insertCell(0);
1109        //           cell1.colSpan = "4";
1110        //           cell1.innerHTML = "Toro";
1111        //           cell1.style.color = 'red';
1112        //           cell1.style.fontWeight = 'bold';
1113        //           cell1.style.border = '1px solid';
1114        //           cell1.style.borderColor = 'transparent';
1115        //           cell1.style.fontSize = '20px';
1116
1117        //           var row2 = table.insertRow(index+1);
1118        //           row2.style.border = 'none';
1119        //           var cell1 = row2.insertCell(0);
1120        //           cell1.colSpan = "4";
1121        //           cell1.innerHTML = "SERVICIO DIURNO ( de 9:45 H. a 22:00 H.) SERVICIO NOCTURNO ( de 22:00 H. a 9:45 H del día siguiente)";
1122        //           cell1.style.border = '1px solid';
1123        //           cell1.style.borderColor = 'transparent';
1124        //           cell1.style.fontWeight = 'bold';
1125        //           cell1.style.color = 'black';
1126        //           cell1.style.padding = '4px';
1127
1128        //       }
1129        //   });
1130
1131        //     $('#tablaPortadaGuardias tr').each(function (index) {
1132
1133        //       var filaFarmaciaGuardia = $(this.cells[0]).text().trim();
1134
1135        //       if(filaFarmaciaGuardia == 'Guareña'){
1136        //           console.log(index)
1137        //           var table = document.getElementById("tablaPortadaGuardias");
1138        //           var row = table.insertRow(index);
1139        //           row.style.border = 'none';
1140        //           var cell1 = row.insertCell(0);
1141        //           cell1.colSpan = "4";
1142        //           cell1.innerHTML = "Guareña";
1143        //           cell1.style.color = 'red';
1144        //           cell1.style.fontWeight = 'bold';
1145        //           cell1.style.border = '1px solid';
1146        //           cell1.style.borderColor = 'transparent';
1147        //           cell1.style.fontSize = '20px';
1148
1149        //           var row2 = table.insertRow(index+1);
1150        //           row2.style.border = 'none';
1151        //           var cell1 = row2.insertCell(0);
1152        //           cell1.colSpan = "4";
1153        //           cell1.innerHTML = "SERVICIO NOCTURNO ( de 22.00 H. a 9.45 H. día siguiente) TORO";
1154        //           cell1.style.border = '1px solid';
1155        //           cell1.style.borderColor = 'transparent';
1156        //           cell1.style.fontWeight = 'bold';
1157        //           cell1.style.color = 'black';
1158        //           cell1.style.padding = '4px';
1159
1160        //       }
1161        //   });
1162
1163        //   $('#tablaPortadaGuardias tr').each(function (index) {
1164
1165        //     var filaFarmaciaGuardia = $(this.cells[0]).text().trim();
1166
1167        //     if(filaFarmaciaGuardia == 'Campos Lampreana'){
1168        //         console.log(index)
1169        //         var table = document.getElementById("tablaPortadaGuardias");
1170        //         var row = table.insertRow(index);
1171        //         row.style.border = 'none';
1172        //         var cell1 = row.insertCell(0);
1173        //         cell1.colSpan = "4";
1174        //         cell1.innerHTML = "Campos Lampreana";
1175        //         cell1.style.color = 'red';
1176        //         cell1.style.fontWeight = 'bold';
1177        //         cell1.style.border = '1px solid';
1178        //         cell1.style.borderColor = 'transparent';
1179        //         cell1.style.fontSize = '20px';
1180
1181        //         var row2 = table.insertRow(index+1);
1182        //         row2.style.border = 'none';
1183        //         var cell1 = row2.insertCell(0);
1184        //         cell1.colSpan = "4";
1185        //         cell1.innerHTML = "SERVICIO NOCTURNO ( de 22.00 H. a 9.30 H. día siguiente) BENAVENTE";
1186        //         cell1.style.border = '1px solid';
1187        //         cell1.style.borderColor = 'transparent';
1188        //         cell1.style.fontWeight = 'bold';
1189        //         cell1.style.color = 'black';
1190        //         cell1.style.padding = '4px';
1191
1192        //     }
1193        // });
1194
1195
1196        if (URLactual.toString().indexOf('buscador-medicamentos') != -1) {
1197
1198            $('#tabla_medicamentos').on('draw.dt', function() {
1199
1200                $('#tabla_medicamentos tbody tr').each(function() {
1201
1202                    //var estado = ( $(this.children[4].childNodes[0]).text() );
1203                    ($(this.children[2]).css('font-weight', ' bold'));
1204
1205                    // if(estado == "BAJA"){
1206                    //       $(this).css('color',' red');
1207                    //       $(this).css('font-weight',' bold');
1208                    // }else{
1209                    //     $(this).css('color',' green');
1210                    //     $(this).css('font-weight',' bold');
1211                    // }
1212
1213
1214                });
1215
1216            });
1217
1218            $("#tabla_medicamentos_wrapper").css("padding-top", "50px");
1219            $("#tabla_medicamentos_length").css("display", "none");
1220            $("#tabla_medicamentos_filter").css("display", "none");
1221
1222            //quitando la columna código nacional - cuarta columna
1223
1224
1225            $("#tabla_medicamentos > tbody").css("display", "none");
1226            $("#tabla_medicamentos_paginate").css("display", "none");
1227            $("#tabla_medicamentos_info").css("display", "none");
1228
1229            $('#tabla_medicamentos_filter > label > input').attr('id', 'buscadorMedicamentosGlobal');
1230            //$('#buscadorDietoterapicos').bind('onchange', 'alert("hola")');
1231
1232            var flagBuscadorGlobal_Medicamentos = false;
1233            var flagBuscadorCodigo_Medicamentos = false;
1234            var flagBuscadorNombreMedicamentos = false;
1235
1236            $('#buscadorMedicamentosGlobal').bind('input', function() {
1237
1238                if ($(this).val().length < 3) {
1239                    flagBuscadorGlobal_Medicamentos = false;
1240                } else {
1241                    flagBuscadorGlobal_Medicamentos = true;
1242                }
1243
1244                if (flagBuscadorGlobal_Medicamentos || flagBuscadorCodigo_Medicamentos || flagBuscadorNombreMedicamentos) {
1245                    $("#tabla_medicamentos > tbody").css("display", "table-row-group");
1246                    $("#tabla_medicamentos_paginate").css("display", "block");
1247                    $("#tabla_medicamentos_info").css("display", "block");
1248                } else {
1249                    $("#tabla_medicamentos > tbody").css("display", "none");
1250                    $("#tabla_medicamentos_paginate").css("display", "none");
1251                    $("#tabla_medicamentos_info").css("display", "none");
1252                }
1253
1254                $(this).blur();
1255                $(this).focus();
1256            });
1257
1258            $('#frmCodigo').bind('input', function() {
1259                if ($(this).val().length < 3) {
1260                    flagBuscadorCodigo_Medicamentos = false;
1261                } else {
1262                    flagBuscadorCodigo_Medicamentos = true;
1263                }
1264
1265                if (flagBuscadorGlobal_Medicamentos || flagBuscadorCodigo_Medicamentos || flagBuscadorNombreMedicamentos) {
1266                    $("#tabla_medicamentos > tbody").css("display", "table-row-group");
1267                    $("#tabla_medicamentos_paginate").css("display", "block");
1268                    $("#tabla_medicamentos_info").css("display", "block");
1269                } else {
1270                    $("#tabla_medicamentos > tbody").css("display", "none");
1271                    $("#tabla_medicamentos_paginate").css("display", "none");
1272                    $("#tabla_medicamentos_info").css("display", "none");
1273                }
1274
1275                $(this).blur();
1276                $(this).focus();
1277            });
1278
1279            $('#frmNombre').bind('input', function() {
1280
1281                if ($(this).val().length < 3) {
1282                    flagBuscadorNombreMedicamentos = false;
1283                } else {
1284                    flagBuscadorNombreMedicamentos = true;
1285                }
1286
1287                if (flagBuscadorGlobal_Medicamentos || flagBuscadorCodigo_Medicamentos || flagBuscadorNombreMedicamentos) {
1288                    $("#tabla_medicamentos > tbody").css("display", "table-row-group");
1289                    $("#tabla_medicamentos_paginate").css("display", "block");
1290                    $("#tabla_medicamentos_info").css("display", "block");
1291                } else {
1292                    $("#tabla_medicamentos > tbody").css("display", "none");
1293                    $("#tabla_medicamentos_paginate").css("display", "none");
1294                    $("#tabla_medicamentos_info").css("display", "none");
1295                }
1296
1297                $(this).blur();
1298                $(this).focus();
1299            });
1300
1301            $("#frmCodigo").off("keyup");
1302            $("#frmCodigo").off("change");
1303            $("#frmCodigo").on("keyup", filtrarTablaMedicamentos);
1304            $("#frmCodigo").on("change", filtrarTablaMedicamentos);
1305
1306            $("#frmNombre").off("keyup");
1307            $("#frmNombre").off("change");
1308            $("#frmNombre").on("keyup", filtrarTablaMedicamentos);
1309            $("#frmNombre").on("change", filtrarTablaMedicamentos);
1310
1311        }
1312
1313
1314		
1315		
1316		$('.abre_formulario').click(function() {
1317				
1318                $("#id-webform-vent").toggle();
1319            });
1320
1321        if (URLactual.toString().indexOf('ventanilla-unica') != -1) {
1322
1323            $('#id-button-edit-online').click(function() {
1324                //$("#id-pdf-edit").css("display", "block");
1325                $("#id-pdf-edit").toggle();
1326                $("#id-webform-vent").hide();
1327            });
1328
1329            $('#id-button-send-formulario').click(function() {
1330                $("#id-webform-vent").toggle();
1331                $("#id-pdf-edit").hide();
1332            });
1333
1334            $("input[name=titulo_oculto]").val("pruebaaaaa");
1335            $("#enlaceDescarDocVentanilla").attr("download", '');
1336        }
1337
1338        if (URLactual.toString().indexOf('user/') != -1) {
1339            $('#block-jango-sub-local-tasks ul.tabs li a').each(function() {
1340
1341
1342                var textoBoton = $(this).text();
1343                if (textoBoton.indexOf('Editar') != -1) {
1344                    $(this).html("Datos de acceso");
1345                } else if (textoBoton.indexOf('Colegiado') != -1) {
1346                    $(this).html("Datos de colegiado");
1347                } else if (textoBoton.indexOf('Ver') != -1) {
1348                    $(this).html("Volver a mi perfil");
1349                }
1350            });
1351
1352
1353            $(".form-item-mail").insertBefore(".form-item-current-pass");
1354
1355            // if ($("div.image-widget").length > 0) {
1356
1357            //     var iDiv = document.createElement('div');
1358            //     iDiv.id = 'infoImagenUsuario';
1359            //     iDiv.innerHTML = "La imágen es común a todos los perfiles: ofertante, demandante, colegiado, titular, etc";
1360            //     document.body.appendChild(iDiv);
1361
1362            //     $("#infoImagenUsuario").insertBefore("div.image-widget");
1363            //     $("#infoImagenUsuario").css('text-decoration', 'underline');
1364            // }
1365        }
1366
1367        substring1 = 'saludo-del-presidente';
1368        substring2 = 'junta-de-gobierno';
1369        substring3 = 'secciones';
1370        substring4 = 'estatutos-colegiales';
1371        substring5 = 'memoria-colegial';
1372        substring6 = 'colegiacion';
1373        substring7 = 'colegiados';
1374        substring8 = 'ubicacion-y-contacto';
1375
1376        $(".tituloPaginaPerfil").parent().parent().parent().addClass("contenidoPaginaPerfil");
1377        $(".contenidoPaginaPerfil").siblings().css("display", "none");
1378
1379        $(".tituloPaginaPerfil").parent().siblings().css("display", "none");
1380
1381        $(".flagOferta").parent().addClass("listaOfertas");
1382        $(".flagOfertaMisOfertas").parent().addClass("listaOfertas2");
1383
1384        $('.contenidoAlertas a').attr('target', '_blank');
1385
1386        if (URLactual.toString().indexOf(substring1) != -1) {
1387
1388            $(".menuLateralColegiacion div ul li:nth-child(1)").css('background-color', 'rgb(160, 22, 22)');
1389            $(".menuLateralColegiacion div ul li:nth-child(1) a").css('color', '#FFF');
1390
1391        } else if (URLactual.toString().indexOf(substring2) != -1) {
1392            $(".menuLateralColegiacion div ul li:nth-child(2)").css('background-color', 'rgb(160, 22, 22)');
1393            $(".menuLateralColegiacion div ul li:nth-child(2) a").css('color', '#FFF');
1394
1395        } else if (URLactual.toString().indexOf(substring3) != -1) {
1396            $(".menuLateralColegiacion div ul li:nth-child(3)").css('background-color', 'rgb(160, 22, 22)');
1397            $(".menuLateralColegiacion div ul li:nth-child(3) a").css('color', '#FFF');
1398        } else if (URLactual.toString().indexOf(substring4) != -1) {
1399            $(".menuLateralColegiacion div ul li:nth-child(4)").css('background-color', 'rgb(160, 22, 22)');
1400            $(".menuLateralColegiacion div ul li:nth-child(4) a").css('color', '#FFF');
1401        } else if (URLactual.toString().indexOf(substring5) != -1) {
1402            $(".menuLateralColegiacion div ul li:nth-child(5)").css('background-color', 'rgb(160, 22, 22)');
1403            $(".menuLateralColegiacion div ul li:nth-child(5) a").css('color', '#FFF');
1404        }
1404 else if (URLactual.toString().indexOf(substring6) != -1) {
1405            $(".menuLateralColegiacion div ul li:nth-child(6)").css('background-color', 'rgb(160, 22, 22)');
1406            $(".menuLateralColegiacion div ul li:nth-child(6) a").css('color', '#FFF');
1407        } else if (URLactual.toString().indexOf(substring7) != -1) {
1408            $(".menuLateralColegiacion div ul li:nth-child(7)").css('background-color', 'rgb(160, 22, 22)');
1409            $(".menuLateralColegiacion div ul li:nth-child(7) a").css('color', '#FFF');
1410        } else if (URLactual.toString().indexOf(substring8) != -1) {
1411            $(".menuLateralColegiacion div ul li:nth-child(8)").css('background-color', 'rgb(160, 22, 22)');
1412            $(".menuLateralColegiacion div ul li:nth-child(8) a").css('color', '#FFF');
1413        } else if (URLactual.toString().indexOf("enviar-formularios") != -1) {
1414
1415            document.getElementById("enviarCorreo").addEventListener("click", function(event) {
1416
1417                var noFunciona = "no";
1418
1419                if (document.getElementById("file").files.length == 0) {
1420
1421                    event.preventDefault()
1422                    alert("No hay adjuntado ningún fichero");
1423                }
1424
1425                if ($('#mail').val().length == 0) {
1426
1427                    event.preventDefault()
1428                    alert('Debe ingresar un email');
1429                }
1430
1431
1432            });
1433        }
1434
1435
1436
1437        if (URLactual.toString().indexOf("estatutos-colegiales") != -1 ||
1438            URLactual.toString().indexOf("memoria-colegial") != -1
1439        ) {
1440
1441            $(document).ready(function() {
1442
1443                const mq = window.matchMedia("(min-width: 991px)");
1444                if (mq.matches) {
1445
1446                    $(".contenedorFicherosDescarga").css({ "padding-left": "27%" });
1447
1448                }
1449
1450            });
1451
1452
1453        }
1454
1455
1456
1457
1458        if (URLactual.toString().indexOf("colegiacion") != -1) {
1459
1460            $(document).ready(function() {
1461                const mq = window.matchMedia("(min-width: 991px)");
1462                if (mq.matches) {
1463                    $(".contenedorFicherosDescarga").css("width", "73%");
1464
1465                }
1466
1467            });
1468
1469
1470        }
1471
1472        $(document).ready(function() {
1473
1474            $(".c-page-breadcrumbs li a").each(function() {
1475                var contenido = $(this).html();
1476                $(this).html(contenido + " /");
1477
1478
1479            });
1480            // $('#edit-submit').on('click', function () {
1481
1482            //   var text = document.getElementById('edit-descripcion-de-la-queja-quejas-y-sugerencias').value.split('\n');
1483            //   var html = text.join('<br />');
1484            //   document.getElementById('edit-descripcion-de-la-queja-quejas-y-sugerencias').value = html
1485
1486
1487            // });
1488
1489            var getUrl = window.location;
1490            var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
1491
1492
1493            $(".contenedorFicherosDescarga .field_ficheros_de_descarga_pagb .data span").each(function() {
1494
1495                if (this.innerHTML.indexOf("application/msword") != -1) {
1496
1497                    $('<img id="theImg" src="/sites/default/files/img/icono_word.png" style="width: 22px; height: 22px; margin-right: 4px;"/>').appendTo(this);
1498
1499                } else if (this.innerHTML.indexOf("application/pdf") != -1) {
1500                    $('<img id="theImg" src="/sites/default/files/img/icono_pdf.png"  style="width: 22px; height: 22px; margin-right: 4px;"/>').appendTo(this);
1501
1502                } else {
1503                    $('<img id="theImg" src="/sites/default/files/img/icono_default.png"  style="width: 22px; height: 22px; margin-right: 4px;"/>').appendTo(this);
1504                }
1505
1506            });
1507
1508            $(".contenedorFicherosDescarga .field_ficheros_de_descarga_pagb .data").each(function() {
1509
1510                $('<hr class="hrFicheros">').appendTo(this);
1511
1512            });
1513
1514            $(".contenedorFicherosDescargaDetalleCampania span").each(function() {
1515
1516                if (this.innerHTML.indexOf("application/msword") != -1) {
1517
1518                    $(this).prepend('<img id="theImg" src="/sites/default/files/img/icono_word.png" style="width: 22px; margin-right: 4px;"/>');
1519
1520                } else if (this.innerHTML.indexOf("application/pdf") != -1) {
1521                    $(this).prepend('<img id="theImg" src="/sites/default/files/img/icono_pdf.png"  style="width: 22px; margin-right: 4px;"/>');
1522
1523                } else {
1524                    $(this).prepend('<img id="theImg" src="/sites/default/files/img/icono_default.png"  style="width: 22px; margin-right: 4px;"/>');
1525                }
1526
1527            });
1528
1529
1530
1531            $(".contenedorInformacionDetalleCampania a").each(function() {
1532
1533                $(this).prepend('<img alt="" data-entity-type="" data-entity-uuid="" src="/sites/default/files/img/pagina_web.png" style="width: 22px; height:22px; margin-right: 4px;"></img>');
1534                $(this).attr('target', '_blank')
1535            });
1536
1537
1538        });
1539
1540
1541        var body_classes = $("input#body-classes").val();
1542        $('body').addClass(body_classes);
1543        if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
1544            $('.c-progress-bar .c-progress-bar-line svg').addClass('c-safari-only');
1545        }
1546
1547        // Fix the menu height for some fixed menus
1548        $('.c-layout-header-fixed .c-layout-header.c-layout-header-4, .c-layout-header-fixed .c-layout-header.c-layout-header-6').each(function() {
1549            $(this).parent().height($(this).height());
1550        });
1551
1552        //para añadir la función ancla a un bloque div en este caso el de la bolsa de empleo
1553        $('#bolsaEmpleo').on('click', function() {
1554            window.location = "/bolsa-de-trabajo-enlace-temporal";
1555        });
1556        $('#enlaceListadoOfertas > span > img').on('click', function() {
1557            window.location = "plataforma-de-empleo/listado-ofertas";
1558        });
1559
1560        //añadiendo la propiedad hover al bloque div de la bolsa de empleo
1561        $("#enlaceListadoOfertas > span > img").hover(function() {
1562            $(this).css("cursor", "pointer");
1563        });
1564
1565        $('#enlaceListadoOfertas > div > h3 > span').on('click', function() {
1566            window.location = "plataforma-de-empleo/listado-ofertas";
1567        });
1568
1569        //añadiendo la propiedad hover al bloque div de la bolsa de empleo
1570        $("#enlaceListadoOfertas > div > h3 > span").hover(function() {
1571            $(this).css("cursor", "pointer");
1572        });
1573
1574
1575
1576        var URLactual = window.location;
1577        var nombreUsuarioLogin = ($(".divNombreUsuarioLogin").text());
1578
1579
1580
1581        //añadiendo la propiedad hover al bloque div de la bolsa de empleo
1582        $("#bolsaEmpleo").hover(function() {
1583            $(this).css("cursor", "pointer");
1584        });
1585
1586        //para añadir la función ancla a un bloque div en este caso el del localizador de farmacias
1587        $('#LocalizadorFarmacias').on('click', function() {
1588            window.location = "es/ciudadanos/localizador-de-farmacias";
1589        });
1590
1591        $('#imagenLogout').on('click', function() {
1592            window.location = "es/user/logout";
1593        });
1594
1595        //añadiendo la propiedad hover al bloque div del localizador de farmacias
1596        $("#LocalizadorFarmacias").hover(function() {
1597            $(this).css("cursor", "pointer");
1598        });
1599
1600        //añadiendo la propiedad hover al bloque div del localizador de farmacias
1601        $("#imagenLogout").hover(function() {
1602            $(this).css("cursor", "pointer");
1603        });
1604
1605        //para añadir la función ancla a un bloque div en este caso el de la ventanilla única
1606        $('#VentanillaUnica').on('click', function() {
1607            window.location = "ciudadanos/ventanilla-unica";
1608        });
1609
1610        $('.redesSociales a').attr('target', '_blank');
1611
1612
1613        //añadiendo la propiedad hover al bloque div de la ventanilla única
1614        $("#VentanillaUnica").hover(function() {
1615            $(this).css("cursor", "pointer");
1616        });
1617
1618        //añadiendo una clase padre para los ficheros de descarga de la página colegiación
1619        $(".field_ficheros_de_descarga_pagb").parent().addClass("contenedorFicherosDescarga");
1620
1621        //añadiendo una clase padre para los ficheros de descarga de la página colegiación
1622        $(".contenedorFullColegiacion").parent().parent().parent().parent().parent().
1623        parent().parent().parent().addClass("contenedorFullColegiacionReal");
1624
1625
1626        if (URLactual.toString().indexOf("farmaceuticos/cau-cim/buscador-medicamentos") != -1) {
1627            // alert("Este buscador ha dejado de funcionar temporalmente. Disculpe las molestias.")
1628        }
1629
1630        if (URLactual.toString().indexOf("admin/people/create") != -1) {
1631            $("#edit-select-roles--wrapper").remove();
1632
1633
1634        }
1635
1636        if (URLactual.toString().indexOf("user/login") != -1) {
1637            var url_string = window.location.href;
1638            var url = new URL(url_string);
1639            var rol = url.searchParams.get("rol");
1640
1641            if (rol == 'ofertante') {
1642
1643                $("a[data-drupal-link-system-path='user/register'").attr("href", "/es/user/register?rol=ofertante")
1644
1645            } else if (rol == 'demandante') {
1646
1647                $("a[data-drupal-link-system-path='user/register'").attr("href", "/es/user/register?rol=demandante")
1648
1649            }
1650
1651
1652            //estableciendo estilo y funcionalidad para el botón de mostrar contraseña
1653            $('.form-item-pass span.glyphicon').css("pointer-events", "auto");
1654            $('.form-item-pass span.glyphicon').removeClass( "glyphicon-lock" )
1655            $('.form-item-pass span.glyphicon').addClass( "glyphicon-eye-open" )
1656
1657            $(".form-item-pass .glyphicon").on('click', function() {
1658                let inputPassword = $('#edit-pass').attr('type');
1659
1660                if(inputPassword!= null && inputPassword === 'password'){
1661                    $('.form-item-pass span.glyphicon').removeClass( "glyphicon-eye-open" )
1662                    $('.form-item-pass span.glyphicon').addClass( "glyphicon-lock" )
1663                    $('#edit-pass').get(0).type = 'text';
1664                }else{
1665                    $('.form-item-pass span.glyphicon').removeClass( "glyphicon-lock" )
1666                    $('.form-item-pass span.glyphicon').addClass( "glyphicon-eye-open" )
1667
1668                    $('#edit-pass').get(0).type = 'password';
1669                }
1670            });
1671
1672        }
1673
1674        if (URLactual.toString().indexOf("/user/") != -1) {
1675            document.querySelectorAll('.item-list-usuario a').forEach(element => {
1676                if(element.text === 'Volver a mi perfil'){
1677                    element.style.backgroundColor = "#1B5E20";
1678                    element.style.color = "white";
1679                }
1680            });
1681
1682
1683            const fechaHoy = new Date().toISOString().split('T')[0]; //formato YYYY-mm-dd
1684            $('#edit-field-finalestudios-demandante-0-value-date').attr('min', fechaHoy);
1685
1686        }
1687
1688        if (URLactual.toString().indexOf("/user/login") != -1) {
1689            $(".c-shop-login-register-1 .row .col-md-6:nth-child(2)").css('display', 'none');
1690            $("#block-jango-sub-local-tasks ul li:nth-child(1)").css('display', 'none');
1691            $(".c-shop-login-register-1 .row").css('display', 'flex');
1692            $(".c-shop-login-register-1 .row").css('justify-content', 'center');
1693            $("#edit-actions").css('display', 'flex');
1694            $("#edit-actions").css('justify-content', 'center');
1695
1696        }
1697        if (URLactual.toString().indexOf("formulario-declaracion-responsab")) {
1698            $('#webform-submission-formulario-declaracion-responsab-add-form').attr('action', '/declaracion-responsable.php');
1699        }
1700        if (URLactual.toString().indexOf("instancia-al-colegio-laboral")) {
1701            $('#webform-submission-instancia-al-colegio-laboral-add-form').attr('action', '/instancia-colegio.php');
1702        }
1703        if (URLactual.toString().indexOf("quejas-y-sugerencias")) {
1704            $('#webform-submission-quejas-y-sugerencias-add-form').attr('action', '/quejas-y-sugerencias.php');
1705        } else if (URLactual.toString().indexOf("solicitud-de-adjunto-laboral")) {
1706            $('#webform-submission-solicitud-de-adjunto-laboral-add-form').attr('action', 'solicitud-adjunto.php');
1707        } else if (URLactual.toString().indexOf("solicitud-de-adjunto-laboral")) {
1708            $('#webform-submission-solicitud-de-adjunto-laboral-add-form').attr('action', 'solicitud-adjunto.php');
1709        } else if (URLactual.toString().indexOf("solicitud-de-adjunto-laboral")) {
1710            $('#webform-submission-solicitud-de-adjunto-laboral-add-form').attr('action', 'solicitud-adjunto.php');
1711        }
1712        //para las farmacias
1713        div2 = $('.menuPrincipal header div .container div .c-mega-menu ul')[0];
1714
1715
1716        if (URLactual.toString().indexOf("/secretaria-tecnica/agenda") != -1) {
1717
1718            $('.fc-event-container > a > div > span.fc-time').each(function(index) {
1719                $(this).css("display", "none");
1720            })
1721
1722
1723
1724        }
1725
1726        function insertAfter(e,i){ 
1727            if(e.nextSibling){ 
1728                e.parentNode.insertBefore(i,e.nextSibling); 
1729            } else { 
1730                e.parentNode.appendChild(i); 
1731            }
1732        }
1733
1734
1735        /*
1736              var span = document.createElement('span');
1737              span.setAttribute('id', 'spanTextLogout');
1738              span.innerHTML = "Salir";
1739              contenedorLogout.appendChild(span);
1740        */
1741
1742        $('.iconoLogout').on('click', function() {
1743            window.location = "es/user/logout";
1744        });
1745
1746        $(".iconoLogout").hover(function() {
1747            $(this).css("cursor", "pointer");
1748        });
1749
1750
1751        //para quitar los items de menu principal que sean de nivel 4 para los roles que no sean admin, titular y colegiado
1752        //se ha añadido desde el template del submenu en cofzamora_des
1752/module/contrib/tb_megamenu/templates/tb-megamenu-subnav.html.twig
1753        //la clase "miClase" cuando hay un elemento de menu de nivel 4 y el usuario logueado no es ni admin, ni ti tular ni colegiado
1754        //y para seleciconar la lista que de verdad hay que desaparecer se selecciona al "padre del padre" del elemento con clase "miClase"
1755        //que es en el archivo compontents.css se realiza un display none  ---> .padreElementoMenuNivel{display: none !important;}
1756        $(".miClase").parent().parent().addClass("padreElementoMenuNivel");
1757
1758        //para poner la bandera de españa en la pagina 
1759        $(".flag-container .selected-flag .iti-flag").removeClass("us");
1760        $(".flag-container .selected-flag .iti-flag ").addClass("es");
1761        $(".flag-container .selected-flag").attr("title", "Spain (España): +34");
1762        $("#edit-phone").val("+34");
1763
1764
1765
1766
1767        $('.owl-carousel').owlCarousel({
1768            loop: true,
1769            margin: 10,
1770            nav: true,
1771            items: 1,
1772            onInitialize: function(event) {
1773                if ($('.owl-carousel .item').length <= 1) {
1774                    this.settings.loop = false;
1775                }
1776            }
1777        });
1778
1779    });
1780
1781    function accionPulsarSwitch(){
1782        $('div.btnAccionBolsaEmpleo input').on('click', function(event) {
1783            let form =  $(this).closest("form")[0];
1784            var opcion = confirm("¿Está seguro?");
1785            if (opcion == true) {
1786                form.submit();
1787            }else{
1788                event.preventDefault()
1789            }
1790        });
1791
1792        $('div.btnAccionBolsaEmpleo2 input').on('click', function(event) {
1793            let form =  $(this).closest("form")[0];
1794            var opcion = confirm("¿Está seguro?");
1795            if (opcion == true) {
1796                form.submit();
1797            }else{
1798                event.preventDefault()
1799            }
1800        });
1801    }
1802
1803    function resetearclick(){
1804        
1805        var estaCargando = $( ".ajax-progress-fullscreen" ).length == 1;
1806        var intervaloFuncionBuscarOfertas = setInterval(function () {
1807            $("#divComienzanOfertasZamora").remove();
1808            $("#divComienzanOfertasNoZamora").remove();
1809            $("#divComienzanOfertasZamora2").remove();
1810            $("#divComienzanOfertasNoZamora2").remove();
1811            formatearOfertasEmpleo();
1812            estaCargando = $( ".ajax-progress-fullscreen" ).length == 1;
1813            if(!estaCargando){
1814                clearInterval(intervaloFuncionBuscarOfertas);
1815            }
1816        }, 300);
1817    }
1818
1819    /*TROZO DE CODIGO PARA PONER LA FECHA FORMATEADA EN LA SECCION FARMACIAS */
1820    /*TROZO DE CODIGO PARA PONER LA FECHA FORMATEADA EN LA SECCION FARMACIAS */
1821    function dameFecha() {
1822        //fecha de hoy
1823        var today = new Date();
1824
1825        //se recoge la fecha en variables
1826        var horas = today.getHours();
1827        var minutos = today.getMinutes();
1828        var segundos = today.getSeconds();
1829        var mes = today.getMonth() + 1;
1830        var dia = today.getDate();
1831        var ano = today.getFullYear();
1832
1833        //para poner un 0 si los minutos, segundos, mes o día esta entre 1 y 9 y quede 01,02, etc
1834        minutos = revisarTiempo(minutos);
1835        segundos = revisarTiempo(segundos);
1836        mes = revisarTiempo(mes);
1837        dia = revisarTiempo(dia);
1838
1839        //para sacar el string del mes 
1840        var mesString;
1841        switch (mes.toString()) {
1842            case "01":
1843                mesString = 'Enero';
1844                break;
1845            case "02":
1846                mesString = 'Febrero';
1847                break;
1848            case "03":
1849                mesString = 'Marzo';
1850                break;
1851            case "04":
1852                mesString = 'Abril';
1853                break;
1854            case "05":
1855                mesString = 'Mayo';
1856                break;
1857            case "06":
1858                mesString = 'Junio';
1859                break;
1860            case "07":
1861                mesString = 'Julio';
1862                break;
1863            case "08":
1864                mesString = 'Agosto';
1865                break;
1866            case "09":
1867                mesString = 'Septiembre';
1868                break;
1869            case "10":
1870                mesString = 'Octubre';
1871                break;
1872            case "11":
1873                mesString = 'Noviembre';
1874                break;
1875            case "12":
1876                mesString = 'Diciembre';
1877                break;
1878        }
1879
1880        //escribiendo la fecha correctamente
1881        var time = horas + ":" + minutos + ":" + segundos;
1882        var date = dia + ' de ' + mesString + ' de ' + ano;
1883
1884        var dias = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"];
1885
1886        var d = new Date();
1887        var dayOfWeek = dias[d.getDay()];
1888
1889        var dateTime = dayOfWeek + ', ' + date + ' ' + time;
1890
1891        //escribiendo la fecha en el span cuya clase es fechaYHoraFarmacias
1892        $(".fechaYHoraFarmacias").html(dateTime);
1893
1894        var time = setTimeout(function() { dameFecha() }, 500);
1895
1896    }
1897
1898
1899
1900
1901
1902    function revisarTiempo(i) {
1903        if (i < 10) {
1904            i = "0" + i;
1905        }
1906        return i;
1907        /*Esta funcion le agrega un 0 
1908        a una variable i que sea menor a 10*/
1909    }
1910
1911    function diaSemana(dia, mes, anio) {
1912        var dias = ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"];
1913        var dt = new Date(mes + ' ' + dia + ', ' + anio);
1914        return dias[dt.getDay()];
1915    }
1916
1917    window.onload = function() {
1918        dameFecha();
1919
1920
1921    }
1922
1923
1924    /* FINAL
1925     TROZO DE CODIGO PARA PONER LA FECHA FORMATEADA EN LA SECCION FARMACIAS */
1926
1927
1928
1929
1930
1931
1932    Drupal.behaviors.webform_js = {
1933        attach: function(context, settings) {
1934            $('.js-form-item button', context).click(function() {
1935                $(this).closest('form').submit();
1936            });
1937        }
1938    };
1939
1940    Drupal.behaviors.product_review = {
1941        attach: function(context, settings) {
1942            $('.write-review-link', context).click(function() {
1943                $('.review-toggler').click();
1944            });
1945        }
1946    };
1947
1948    Drupal.behaviors.product_zoom = {
1949        attach: function(context, settings) {
1950
1951            $('.c-product-gallery-content .c-zoom', context).toggleClass('c-hide'); // INIT FUNCTION - HIDE ALL IMAGES
1952
1953            // SET GALLERY ORDER
1954            var i = 1;
1955            $('.c-product-gallery-content .c-zoom', context).each(function() {
1956                $(this).attr('img_order', i);
1957                i++;
1958            });
1959
1960            // INIT ZOOM MASTER PLUGIN
1961            $('.c-zoom', context).each(function() {
1962                $(this).zoom();
1963            });
1964
1965            // ASSIGN THUMBNAIL TO IMAGE
1966            var i = 1;
1967            $('.c-product-thumb img', context).each(function() {
1968                $(this).attr('img_order', i);
1969                i++;
1970            });
1971
1972            // INIT FIRST IMAGE
1973            $('.c-product-gallery-content .c-zoom[img_order="1"]', context).toggleClass('c-hide');
1974
1975            // CHANGE IMAGES ON THUMBNAIL CLICK
1976            $('.c-product-thumb img', context).click(function() {
1977                var img_target = $(this).attr('img_order');
1978
1979                $('.c-product-gallery-content .c-zoom').addClass('c-hide');
1980                $('.c-product-gallery-content .c-zoom[img_order="' + img_target + '"]').removeClass('c-hide');
1981            });
1982
1983            // SET THUMBNAIL HEIGHT
1984            var thumb_width = $('.c-product-thumb').width();
1985            $('.c-product-thumb').height(thumb_width);
1986
1987        }
1988    };
1989
1990    Drupal.behaviors.theme_styles = {
1991        attach: function(context, settings) {
1992            $('.c-settings .c-color', context).on('click', function() {
1993
1994                $('#nd_style_theme').remove();
1995                var val = $(this).attr('data-color');
1996                $('body')
1997                    .append('<link href="/d8/themes/custom/jango/assets/base/css/themes/' + val + '.css" rel="stylesheet" id="nd_style_theme" type="text/css">');
1998
1999                $('.c-settings .c-color').removeClass('c-active');
2000                $(this).addClass('c-active');
2001            });
2002
2003        }
2004    };
2005
2006    Drupal.behaviors.js_styles = {
2007        attach: function(context, settings) {
2008            $('.c-content-isotope-overlay-content .flag, .c-content-isotope-overlay-content .commerce-a
2008dd-to-cart button', context)
2009                .removeAttr('class')
2010                .attr('class', 'c-content-isotope-overlay-btn btn c-btn-white c-btn-uppercase c-btn-bold c-btn-border-1x c-btn-square');
2011
2012            $('.node-product-teaser .c-content-product-2 .form-submit', context)
2013                .removeAttr('class')
2014                .attr('class', 'btn btn-lg c-btn-white c-btn-uppercase c-btn-square c-font-grey-3 c-font-white-hover c-bg-red-2-hover c-btn-product');
2015
2016            $('.node-product-teaser-list .c-content-product-2 .form-submit', context)
2017                .removeAttr('class')
2018                .attr('class', 'btn btn-sm c-theme-btn c-btn-square c-btn-uppercase c-btn-bold');
2019
2020            $('.node-product-teaser-list .flag-compare a, .node-product-teaser-list .flag-wishlist a', context)
2021                .addClass('flag btn btn-sm btn-default c-btn-square c-btn-uppercase c-btn-bold');
2022        }
2023    };
2024
2025    Drupal.behaviors.cart_delete = {
2026        attach: function(context, settings) {
2027            $('.c-cart-remove > a', context)
2028                .click(function(event) {
2029                    event.preventDefault();
2030                    $(this).closest('div').find('input').click();
2031                });
2032            $('.c-cart-menu-close .c-theme-link', context)
2033                .click(function(event) {
2034                    event.preventDefault();
2035                    $(this).closest('li').find('input').click();
2036                });
2037        }
2038    };
2039
2040    Drupal.behaviors.dropdown_menu_expand = {
2041        attach: function(context, settings) {
2042            $('.c-sidebar-menu .is-active', context).closest('.c-dropdown').addClass('c-open');
2043        }
2044    };
2045
2046    Drupal.behaviors.write_review = {
2047        attach: function(context, settings) {
2048            $('.c-product-write-review', context).click(function() {
2049                $('#bootstrap-fieldgroup-nav-item--reviews-3').click();
2050            });
2051        }
2052    };
2053
2054    Drupal.behaviors.split_submit_button = {
2055        attach: function(context, settings) {
2056            $('.form-split-button .btn', context).click(function() {
2057                $(this).parent().find('form').submit();
2058                return false;
2059            });
2060        }
2061    };
2062
2063    Drupal.behaviors.products_filter_show = {
2064        attach: function(context, settings) {
2065            $('.auto-click', context).find('li:first a').click();
2066        }
2067    };
2068
2069    Drupal.behaviors.product_filter = {
2070        attach: function(context, settings) {
2071
2072            if ($('input[name="field_stock_amount_value"]').val() > 0) {
2073                $('#checkbox-sidebar-3-2', context).attr('checked', 'checked');
2074            }
2075
2076            $('#checkbox-sidebar-3-2', context).click(function() {
2077                $('input[name="field_stock_amount_value"]')
2078                    .val($(this).attr('checked') != undefined ? 1 : 0)
2079                    .closest('form')
2080                    .submit();
2081            });
2082
2083            $('input[name="from_textfield"]', context)
2084                .val($('input[name="commerce_price_amount[min]"]').val());
2085            $('input[name="to_textfield"]', context)
2086                .val($('input[name="commerce_price_amount[max]"]').val());
2087
2088            var min = $('input[name="commerce_price_amount[min]"]').val();
2089            var max = $('input[name="commerce_price_amount[max]"]').val();
2090            min = min ? min : 0;
2091            max = max ? max : 500;
2092
2093            $('.range-text').text(min / 20 + ' - ' + max * 4);
2094            $('.nd-price-slider')
2095                .attr('data-slider-value', '[' + min + ',' + max + ']')
2096                .attr('data-slider-min', min / 20)
2097                .attr('data-slider-max', max * 4)
2098                .slider();
2099
2100            $('input[name="from_textfield"]', context).change(function() {
2101                $('input[name="commerce_price_amount[min]"]')
2102                    .val($(this).val())
2103                    .closest('form')
2104                    .submit();
2105            });
2106
2107            $('input[name="to_textfield"]', context).change(function() {
2108                $('input[name="commerce_price_amount[max]"]')
2109                    .val($(this).val())
2110                    .closest('form')
2111                    .submit();
2112            });
2113
2114            $('.filter-range-wrapper', context).click(function() {
2115                var range = $(this).find('.nd-price-slider').val().split(',');
2116                $('input[name="commerce_price_amount[min]"]').val(range[0]);
2117                $('input[name="commerce_price_amount[max]"]')
2118                    .val(range[1])
2119                    .closest('form')
2120                    .submit();
2121            });
2122
2123            var stars = $('input[name="field_rating_rating"]').val();
2124            $('.filter-rating-wraper input[data-stars=' + stars + ']')
2125                .attr('checked', 'checked');
2126
2127            $('.filter-rating-wraper input').change(function() {
2128                $('.filter-rating-wraper input:checked').click();
2129                var stars = $(this).attr('checked') == undefined ? '' : $(this)
2130                    .data('stars');
2131                $('input[name="field_rating_rating"]')
2132                    .val(stars)
2133                    .closest('form')
2134                    .submit();
2135            });
2136        }
2137    };
2138
2139    // ISOTOPE GRID
2140    var IsotopeGrid = function() {
2141        var _init = function() {
2142            // BEGIN: ISOTOPE GALLERY 1 INIT
2143            // init isotope gallery
2144            var $grid1 = $('.c-content-isotope-grid.c-opt-1')
2145                .imagesLoaded(function() {
2146                    // init Isotope after all images have loaded
2147                    $grid1.isotope({
2148                        // options...
2149                        itemSelector: '.c-content-isotope-item',
2150                        layoutMode: 'packery',
2151                        fitWidth: true,
2152                        percentPosition: true
2153                    });
2154                });
2155            // END: ISOTOPE GALLERY 1
2156
2157            // BEGIN: ISOTOPE GALLERY 2 INIT
2158            // init isotope gallery
2159            var $grid2 = $('.c-content-isotope-grid.c-opt-2')
2160                .imagesLoaded(function() {
2161                    // init Isotope after all images have loaded
2162                    $grid2.isotope({
2163                        // options...
2164                        itemSelector: '.c-content-isotope-item',
2165                        layoutMode: 'packery',
2166                        fitWidth: true,
2167                        percentPosition: true
2168                    });
2169                });
2170            // END: ISOTOPE GALLERY 2
2171
2172            // BEGIN: ISOTOPE GALLERY 3 INIT
2173            // init isotope gallery
2174            var $grid3 = $('.c-content-isotope-grid.c-opt-3')
2175                .imagesLoaded(function() {
2176                    // init Isotope after all images have loaded
2177                    $grid3.isotope({
2178                        // options...
2179                        itemSelector: '.c-content-isotope-item',
2180                        layoutMode: 'packery',
2181                        fitWidth: true,
2182                        percentPosition: true
2183                    });
2184                });
2185            // END: ISOTOPE GALLERY 3
2186        };
2187        return {
2188            //main function to initiate the module
2189            init: function() {
2190                _init();
2191            }
2192        };
2193    }();
2194
2195    // ISOTOPE GALLERY
2196    var IsotopeGallery = function() {
2197        var _init = function() {
2198            // BEGIN: ISOTOPE GALLERY 1 INIT
2199            // init ilightbox
2200            $('.c-ilightbox-image-1').iLightBox();
2201
2202            // init isotope gallery
2203            var $grid1 = $('.c-content-isotope-gallery.c-opt-1')
2204                .imagesLoaded(function() {
2205                    // init Isotope after all images have loaded
2206                    $grid1.isotope({
2207                        // options...
2208                        itemSelector: '.c-content-isotope-item',
2209                        layoutMode: 'packery',
2210                        fitWidth: true,
2211                        percentPosition: true
2212                    });
2213                });
2214            // END: ISOTOPE GALLERY 1
2215
2216            // BEGIN: ISOTOPE GALLERY 2 INIT
2217            // init ilightbox
2218            $('.c-ilightbox-image-2').iLightBox({ skin: 'light' });
2219
2220            // init isotope gallery
2221            var $grid2 = $('.c-content-isotope-gallery.c-opt-2')
2222                .imagesLoaded(function() {
2223                    // init Isotope after all images have loaded
2224                    $grid2.isotope({
2225                        // options...
2226                        itemSelector: '.c-content-isotope-item',
2227                        layoutMode: 'packery',
2228                        fitWidth: true,
2229                        percentPosition: true
2230                    });
2231                });
2232            // END: ISOTOPE GALLERY 2
2233
2234            // BEGIN: ISOTOPE GALLERY 3 INIT
2235            // init ilightbox
2236            $('.c-ilightbox-image-3').iLightBox();
2237
2238            // init isotope gallery
2239            var $grid3 = $('.c-content-isotope-gallery.c-opt-3')
2240                .imagesLoaded(function() {
2241                    // init Isotope after all images have loaded
2242                    $grid3.isotope({
2243                        // options...
2244                        itemSelector: '.c-content-isotope-item',
2245                        layoutMode: 'packery',
2246                        fitWidth: true,
2247                        percentPosition: true
2248                    });
2249                });
2250            // END: ISOTOPE GALLERY 3
2251
2252            // BEGIN: ISOTOPE GALLERY 4 INIT
2253            // init ilightbox
2254            $('.c-ilightbox-image-4').iLightBox();
2255
2256            // init isotope gallery
2257            var $grid4 = $('.c-content-isotope-gallery.c-opt-4')
2258                .imagesLoaded(function() {
2259                    // init Isotope after all images have loaded
2260                    $grid4.isotope({
2261                        // options...
2262                        itemSelector: '.c-content-isotope-item',
2263                        layoutMode: 'packery',
2264                        fitWidth: true,
2265                        percentPosition: true
2266                    });
2267                });
2268            // Filter buttons
2269            $('.c-content-isotope-filter-1').on('click', 'button', function() {
2270                var filterValue = $(this).attr('data-filter');
2271                $grid4.isotope({ filter: filterValue });
2272                $('.c-content-isotope-filter-1 .c-isotope-filter-btn')
2273                    .removeClass('c-active');
2274                $(this).addClass('c-active');
2275
2276                // scroll to top of element on click
2277                $('html, body').stop();
2278            });
2279            // END: ISOTOPE GALLERY 4
2280
2281            // BEGIN: ISOTOPE GALLERY 5 INIT
2282            // init ilightbox
2283            $('.c-ilightbox-image-5').iLightBox();
2284
2285            // init isotope gallery
2286            var $grid5 = $('.c-content-isotope-gallery.c-opt-5')
2287                .imagesLoaded(function() {
2288                    // init Isotope after all images have loaded
2289                    $grid5.isotope({
2290                        // options...
2291                        itemSelector: '.c-content-isotope-item',
2292                        layoutMode: 'packery',
2293                        fitWidth: true,
2294                        percentPosition: true
2295                    });
2296                });
2297            // Filter buttons
2298            $('.c-content-isotope-filter-2').on('click', 'button', function() {
2299                var filterValue = $(this).attr('data-filter');
2300                $grid5.isotope({ filter: filterValue });
2301                $('.c-content-isotope-filter-2 .c-isotope-filter-btn')
2302                    .removeClass('c-active');
2303                $(this).addClass('c-active');
2304
2305                // scroll to top of element on click
2306                $('html, body').stop();
2307            });
2308            // END: ISOTOPE GALLERY 5
2309
2310        };
2311        return {
2312            //main function to initiate the module
2313            init: function() {
2314                _init();
2315            }
2316        };
2317    }();
2318
2319    function reloadPage() {
2320        location.reload();
2321    }
2322
2323    var getUrlParameter = function getUrlParameter(sParam) {
2324        var sPageURL = window.location.search.substring(1),
2325            sURLVariables = sPageURL.split('&'),
2326            sParameterName,
2327            i;
2328    
2329        for (i = 0; i < sURLVariables.length; i++) {
2330            sParameterName = sURLVariables[i].split('=');
2331    
2332            if (sParameterName[0] === sParam) {
2333                return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
2334            }
2335        }
2336        return false;
2337    };
2338
2339
2340    $(document).ready(function() {
2341
2342        $('#btn-reportar-denuncia').on('click', function(event) {
2343
2344            const urlIdParameter = getUrlParameter("oferta");
2345
2346            $("input[name=idOferta]").val(urlIdParameter);
2347        });
2348
2349        $('.isotope-gallery-action a').click(function(event) {
2350            event.preventDefault();
2351            var column = $(this).attr('data-id');
2352            $.post(Drupal.url('ajax/jango/save-variable'), {
2353                'variable': 'jango_isotope_gallery',
2354                'variable_key': $(this)
2355                    .parents('.isotope-gallery-action')
2356                    .attr('data-id'),
2357                'value': column
2358            });
2359
2360            if (column == 2) {
2361                $(this)
2362                    .closest('.c-content-isotope-item')
2363                    .addClass('c-item-size-double');
2364            } else {
2365                $(this)
2366                    .closest('.c-content-isotope-item')
2367                    .removeClass('c-item-size-double');
2368            }
2369            $('.c-content-isotope-gallery').isotope();
2370            return false;
2371        });
2372
2373        $('.isotope-portfolio-action a').click(function(event) {
2374            event.preventDefault();
2375            $.post(Drupal.url('ajax/jango/save-variable'), {
2376                'variable': 'jango_isotope_gallery',
2377                'variable_key': $(this)
2378                    .parents('.isotope-portfolio-action')
2379                    .attr('data-id'),
2380                'value': $(this).attr('data-id')
2381            });
2382            setTimeout(reloadPage, 100);
2383        });
2384
2385        IsotopeGrid.init();
2386        IsotopeGallery.init();
2387        App.init(); // init core
2388
2389        revealAnimate.init();
2390        new WOW().init();
2391
2392        // Portfolio
2393        $('#grid-container-extended:not(.processed)')
2394            .addClass('processed')
2395            .each(function() {
2396                var columns = $(this).data('columns');
2397                // init cubeportfolio
2398                $(this).cubeportfolio({
2399                    filters: '#filters-container',
2400                    layoutMode: 'grid',
2401                    defaultFilter: '*',
2402                    animationType: 'rotateRoom',
2403                    gapHorizontal: 35,
2404                    gapVertical: 25,
2405                    gridAdjustment: 'responsive',
2406                    mediaQueries: [{
2407                        width: 1100,
2408                        cols: columns
2409                    }, {
2410                        width: 800,
2411                        cols: columns
2412                    }, {
2413                        width: 500,
2414                        cols: 2
2415                    }, {
2416                        width: 320,
2417                        cols: 1
2418                    }],
2419                    caption: 'zoom',
2420                    displayType: 'lazyLoading',
2421                    displayTypeSpeed: 100,
2422
2423                    // lightbox
2424                    lightboxDelegate: '.cbp-lightbox',
2425                    lightboxGallery: true,
2426                    lightboxTitleSrc: 'data-title',
2427                    lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
2428
2429                    // singlePage popup
2430                    singlePageDelegate: '.cbp-singlePage',
2431                    singlePageDeeplinking: true,
2432                    singlePageStickyNavigation: true,
2433                    singlePageCounter: '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>',
2434                    singlePageCallback: function(url, element) {
2435                        // to update singlePage content use the following method: this.updateSinglePage(yourContent)
2436                        var t = this;
2437                        url = url[0] == '/' ? url.substr(1) : url;
2438                        $.ajax({
2439                                url: Drupal.url(url),
2440                                type: 'GET',
2441                                dataType: 'html'
2442                                    //                    timeout: 5000
2443                            })
2444                            .done(function(result) {
2445                                result = $(result).find('#content').html();
2446                                t.updateSinglePage(result);
2447                                Drupal.attachBehaviors($('.cbp-popup-wrap'), {});
2448                            })
2449                            .fail(function() {
2450                                t.updateSinglePage("Error! Please refresh the page!");
2451                            });
2452                    }
2453                })
2454            });
2455
2456        $('#grid-container-4col:not(.processed)')
2457            .addClass('processed')
2458            .each(function() {
2459                var columns = $(this).data('columns');
2460                // init cubeportfolio
2461                $(this).cubeportfolio({
2462                    filters: '#filters-container',
2463                    loadMore: '#loadMore-container',
2464                    loadMoreAction: 'click',
2465                    layoutMode: 'grid',
2466                    defaultFilter: '*',
2467                    animationType: 'quicksand',
2468                    gapHorizontal: 35,
2469                    gapVertical: 30,
2470                    gridAdjustment: 'responsive',
2471                    mediaQueries: [{
2472                        width: 1100,
2473                        cols: columns
2474                    }, {
2475                        width: 800,
2476                        cols: columns
2477                    }, {
2478                        width: 500,
2479                        cols: 2
2480                    }, {
2481                        width: 320,
2482                        cols: 1
2483                    }],
2484                    caption: 'overlayBottomReveal',
2485                    displayType: 'sequentially',
2486                    displayTypeSpeed: 80,
2487
2488                    // lightbox
2489                    lightboxDelegate: '.cbp-lightbox',
2490                    lightboxGallery: true,
2491                    lightboxTitleSrc: 'data-title',
2492                    lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
2493
2494                    // singlePage popup
2495                    singlePageDelegate: '.cbp-singlePage',
2496                    singlePageDeeplinking: true,
2497                    singlePageStickyNavigation: true,
2498                    singlePageCounter: '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>',
2499                    singlePageCallback: function(url, element) {
2500                        // to update singlePage content use the following method: this.updateSinglePage(yourContent)
2501                        var t = this;
2502                        url = url[0] == '/' ? url.substr(1) : url;
2503                        $.ajax({
2504                                url: Drupal.url(url),
2505                                type: 'GET',
2506                                dataType: 'html'
2507                                    //                    timeout: 5000
2508                            })
2509                            .done(function(result) {
2510                                result = $(result).find('#content').html();
2511                                t.updateSinglePage(result);
2512                                Drupal.attachBehaviors($('.cbp-popup-wrap'), {});
2513                            })
2514                            .fail(function() {
2515                                t.updateSinglePage("Error! Please refresh the page!");
2516                            });
2517                    }
2518                });
2519            });
2520
2521        $('#grid-container:not(.processed)')
2522            .addClass('processed')
2523            .each(function() {
2524                var columns = $(this).data('columns');
2525                // init cubeportfolio
2526                $(this).addClass('processed').cubeportfolio({
2527                    filters: '#filters-container',
2528                    layoutMode: 'grid',
2529                    defaultFilter: '*',
2530                    animationType: 'quicksand',
2531                    gapHorizontal: 35,
2532                    gapVertical: 25,
2533                    gridAdjustment: 'responsive',
2534                    mediaQueries: [{
2535                        width: 1100,
2536                        cols: columns
2537                    }, {
2538                        width: 800,
2539                        cols: 3
2540                    }, {
2541                        width: 500,
2542                        cols: 2
2543                    }, {
2544                        width: 320,
2545                        cols: 1
2546                    }],
2547                    caption: 'zoom',
2548                    displayType: 'lazyLoading',
2549                    displayTypeSpeed: 100,
2550
2551                    // lightbox
2552                    lightboxDelegate: '.cbp-lightbox',
2553                    lightboxGallery: true,
2554                    lightboxTitleSrc: 'data-title',
2555                    lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
2556
2557                    // singlePage popup
2558                    singlePageDelegate: '.cbp-singlePage',
2559                    singlePageDeeplinking: true,
2560                    singlePageStickyNavigation: true,
2561                    singlePageCounter: '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>',
2562                    singlePageCallback: function(url, element) {
2563                        // to update singlePage content use the following method: this.updateSinglePage(yourContent)
2564                        var t = this;
2565                        url = url[0] == '/' ? url.substr(1) : url;
2566                        $.ajax({
2567                                url: Drupal.url(url),
2568                                type: 'GET',
2569                                dataType: 'html'
2570                            })
2571                            .done(function(result) {
2572                                result = $(result).find('#content').html();
2573                                t.updateSinglePage(result);
2574                                Drupal.attachBehaviors($('.cbp-popup-wrap'), {});
2575                            })
2576                            .fail(function() {
2577                                t.updateSinglePage("Error! Please refresh the page!");
2578                            });
2579                    }
2580                });
2581            });
2582
2583
2584        $('#grid-container-fullwidth:not(.processed)')
2585            .addClass('processed')
2586            .each(function() {
2587                var columns = $(this).data('columns');
2588                // init cubeportfolio
2589                $(this).cubeportfolio({
2590                    filters: '#filters-container',
2591                    loadMore: '#loadMore-container',
2592                    loadMoreAction: 'auto',
2593                    layoutMode: 'grid',
2594                    defaultFilter: '*',
2595                    animationType: 'fadeOutTop',
2596                    gapHorizontal: 0,
2597                    gapVertical: 0,
2598                    gridAdjustment: 'responsive',
2599                    mediaQueries: [{
2600                        width: 1600,
2601                        cols: columns
2602                    }, {
2603                        width: 1200,
2604                        cols: columns
2605                    }, {
2606                        width: 800,
2607                        cols: 3
2608                    }, {
2609                        width: 500,
2610                        cols: 2
2611                    }, {
2612                        width: 320,
2613                        cols: 1
2614                    }],
2615                    caption: 'zoom',
2616                    displayType: 'lazyLoading',
2617                    displayTypeSpeed: 100,
2618
2619                    // lightbox
2620                    lightboxDelegate: '.cbp-lightbox',
2621                    lightboxGallery: true,
2622                    lightboxTitleSrc: 'data-title',
2623                    lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>'
2624                });
2625
2626            });
2627
2628
2629        $('#grid-container-ligthbox:not(.processed)')
2630            .addClass('processed')
2631            .each(function() {
2632                var columns = $(this).data('columns');
2633                $(this).cubeportfolio({
2634                    filters: '#filters-container',
2635                    loadMore: '#loadMore-container',
2636                    loadMoreAction: 'click',
2637                    layoutMode: 'grid',
2638                    mediaQueries: [{
2639                        width: 1100,
2640                        cols: columns
2641                    }, {
2642                        width: 800,
2643                        cols: columns
2644                    }, {
2645                        width: 500,
2646                        cols: 2
2647                    }, {
2648                        width: 320,
2649                        cols: 1
2650                    }],
2651                    defaultFilter: '*',
2652                    animationType: 'rotateSides',
2653                    gapHorizontal: 10,
2654                    gapVertical: 10,
2655                    gridAdjustment: 'responsive',
2656                    caption: 'overlayBottomPush',
2657                    displayType: 'sequentially',
2658                    displayTypeSpeed: 100,
2659
2660                    // lightbox
2661                    lightboxDelegate: '.cbp-lightbox',
2662                    lightboxGallery: true,
2663                    lightboxTitleSrc: 'data-title',
2664                    lightboxCounter: '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>',
2665
2666                    // singlePageInline
2667                    singlePageInlineDelegate: '.cbp-singlePageInline',
2668                    singlePageInlinePosition: 'below',
2669                    singlePageInlineInFocus: true,
2670                    singlePageInlineCallback: function(url, element) {
2671                        // to update singlePageInline content use the following method: this.updateSinglePageInline(yourContent)
2672                        var t = this;
2673                        url = url[0] == '/' ? url.substr(1) : url;
2674                        $.ajax({
2675                                url: Drupal.url(url),
2676                                type: 'GET',
2677                                dataType: 'html',
2678                                cache: false
2679                            })
2680                            .done(function(result) {
2681                                result = $(result).find('#content').html();
2682                                t.updateSinglePageInline(result);
2683                                Drupal.attachBehaviors($('.cbp-popup-wrap'), {});
2684                            })
2685                            .fail(function() {
2686                                t.updateSinglePageInline("Error! Please refresh the page!");
2687                            });
2688                    }
2689                });
2690            });
2691
2692    });
2693}());

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.