PageSourceSearch

https://www.mapfre.pt/contents/ui/theme-Child-Theme/public/js/generico-nueva-marca.js

js mapfre.pt collected 2026-10-02 12:21:50 UTC 4,818 bytes, 131 lines download raw bytes

1/* Subidas intercaladas PRO */
2jQuery(document).ready(function($) {
3
4    // 'nueva-marca' ya se renderiza en el <body> desde el servidor
5    // (functions.php, mg_add_nueva_marca_body_class) para evitar el salto de
6    // layout que causaba añadirla aquí tras el primer pintado.
7
8    // HERO ADD DIV
9    // Recorremos todos los divs con la clase específica
10    $('.ma-hero-home-left-aligned').each(function() {
11        var div = $(this);
12
13        // Crear el nuevo div
14        var nuevoDiv = $('<div class="fondo-hero-home-left"></div>');
15
16        // Mover todos los hijos actuales dentro del nuevo div
17        nuevoDiv.append(div.contents());
18
19        // Añadir el nuevo div dentro del original
20        div.append(nuevoDiv);
21    });
22
23    $('.ma-hero-home-right-aligned .modulo-hero-right').each(function() {
24        var divRight = $(this);
25
26        // Crear el nuevo div
27        var nuevoDivRight = $('<div class="fondo-hero-home-right"></div>');
28
29        // Mover todos los hijos actuales dentro del nuevo div
30        nuevoDivRight.append(divRight.contents());
31
32        // Añadir el nuevo div dentro del original
33        divRight.append(nuevoDivRight);
34    });
35
36    // FIN HERO ADD DIV
37
38    // BANNER ADD DIV
39
40    $('.banner-sin-franja.section-banner .et_pb_row .et_pb_column').each(function() {
41        var divBanner = $(this);
42
43        // Crear el nuevo div
44        var nuevoDivBanner = $('<div class="fondo-hero-banner"></div>');
45
46        // Mover todos los hijos actuales dentro del nuevo div
47        nuevoDivBanner.append(divBanner.contents());
48
49        // Añadir el nuevo div dentro del original
50        divBanner.append(nuevoDivBanner);
51    });
52
53    // FIN BANNER ADD DIV
54
55    // MENU HEADER
56    if(jQuery(window).width() >= 1183) {
57        var divItemLeft = $('li.menu-item-left');
58        var menuSecondaryClass = $('span.magl-sub-menu.level-2');
59        // console.log(menuSecondaryClass);
60        if (divItemLeft.length) {
61            const original = $('.ma-menu-section')
62                .find('.et_pb_with_border.et_pb_column');
63
64            const botones = $('.ma-menu-section')
65                .find('.ma-menu-boton');
66                botones.addClass('ma-menu-boton-new-height');
67 
68            // 1) Clonar e insertar justo debajo
69            const clon = original
70                .clone(true)
71                .addClass('clon')
72                .insertAfter(original);
73
74            // 2) ORIGINAL: eliminar los .menu-item-left y el .magl-menu-rollover
75            original.find('.menu-item-left, .magl-menu-rollover').remove();
76
77            // 3) CLON: seleccionar todos los elementos que deben conservarse
78            //    (menu-item-left y todos sus descendientes y ancestros)
79            const keep = clon.find('.menu-item-left')
80                .add(clon.find('.menu-item-left').parents())
81                .add(clon.find('.menu-item-left').find('*'))
82                .add(clon.find('.magl-menu-rollover'))
83                .add(clon.find('.magl-menu-rollover').find('*'));
84
85            // 4) Eliminar todo lo que NO esté en la lista de conservación
86            clon.find('*').not(keep).remove();
87            // });
88
89            var newHeightMenuRollover = clon.find('.magl-menu-rollover');
90            newHeightMenuRollover.addClass('magl-menu-rollover-new-height');
91
92
93        }
94        if (menuSecondaryClass.length) {
95            const original = $('.ma-menu-section')
96                .find('.et_pb_with_border.et_pb_column_4_4.et_pb_column.et_pb_column_0_tb_header.et_pb_css_mix_blend_mode_passthrough.et-last-child');
97
98            // 1) Clonar e insertar justo debajo
99            const clon = original
100                .clone(true)
101                .addClass('clon')
102                .insertAfter(original);
103
104            // 2) ORIGINAL: eliminar los .menu-item-left y el .magl-menu-rollover
105            original.find('span.magl-sub-menu.level-2, .magl-menu-rollover').remove();
106
107            // 3) CLON: seleccionar todos los elementos que deben conservarse
108            //    (menu-item-left y todos sus descendientes y ancestros)
109            const keep = clon.find('span.magl-sub-menu.level-2')
110                .add(clon.find('span.magl-sub-menu.level-2').parents())
111                .add(clon.find('span.magl-sub-menu.level-2').find('*'))
112                .add(clon.find('.magl-menu-rollover'))
113                .add(clon.find('.magl-menu-rollover').find('*'));
114
115            // 4) Eliminar todo lo que NO esté en la lista de conservación
116            clon.find('*').not(keep).remove();
117            // });
118
119            // AÑADIMOS NUEVA CLASE PARA CALCULAR LA ALTURA DE LOS MENUS QUE SOLO TIENEN NUEVO NIVEL
120            const segundoLevel = $('.ma-menu-section > .et_pb_row');
121            segundoLevel.addClass("segundo-nivel-new-height");
122
123        }
124    }
125
126    // FIN MENU HEADER
127
128
129
130
131});

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.