PageSourceSearch

https://www.cnmv.es/Portal/js/custom.js

js cnmv.es collected 2026-10-01 08:36:54 UTC 16,977 bytes, 492 lines download raw bytes

1/* SCRIPTS GENERALES Y CUSTOMIZADOS */
2
3document.addEventListener("DOMContentLoaded", () => {
4    // ACCESIBILIDAD MASTER PAGE
5    document.getElementById("aspnetForm")?.setAttribute("role", "none presentation");
6});
7
8/* MENU LATERAL (Offcanvas) */
9$(document).ready(function () {
10    $('[data-bs-toggle=offcanvas]').on("click", function () {
11        if ($('.sidebar-offcanvas').css('background-color') == 'rgb(255, 255, 255)') {
12            $('.list-group-item').attr('tabindex', '-1');
13        }
14        else {
15            $('.list-group-item').attr('tabindex', '');
16        }
17        $('.row-offcanvas').toggleClass('active');
18        $('.offcanvas-backdrop').remove();
19    });
20});
21
22jQuery(".btn-nav-open").on("click", function () {
23    window.scrollTo(0, 0);
24
25    jQuery(this).find(".nav-open-icon").toggleClass("nav-closed-icon");
26
27    $(".container-lg").toggleClass("height-menu-sm");
28    $(".opacity-bg").toggleClass("black-bg");
29    $("#maincontent").toggleClass("disabled-menu");//Fondo para movil
30});
31
32(function ($) {
33    $('#arrow-toggle').on("click", function (event) {
34        event.preventDefault();
35        $('img:visible', this).hide().siblings().show();
36        $('#sidebar').toggle($('img:visible').is('.up'));
37    });
38})(jQuery);
39
40/* END MENU LATERAL */
41
42/* TWITTER SHOW */
43$('.account-twitter').hide();
44
45$('.twitter-top').click(function (e) {
46    e.preventDefault();
47    // hide all span
48    var $this = $(this).parent().find('.account-twitter');
49    $(".account-twitter").not($this).hide(0);
50
51    // here is what I want to do
52    $this.toggle(0);
53});
54$(".twitter-open-mobil").click(function () {
55    $('.twitter-mobil').slideToggle();
56});
57
58$('.twitter-top').click(function () {
59    $('.dropdown-toggle').toggleClass('rotated-after');
60});
61/* TWITTER SHOW */
62
63/* DESPLEGAR PESTAÑAS */
64
65/*
66$(".open-tab").click(function() {
67    $(this).siblings('.closed-tab').slideToggle();
68});
69*/
70
71$('.open-tab').click(function () {
72    $(this).toggleClass('rotated-tab');
73    $(this).siblings('.closed-tab').slideToggle();
74});
75
76$('.open-capa').click(function (ev) {
77    ev.preventDefault();
78    $(this).attr('aria-expanded', function (i, attr) {
79        return attr == 'true' ? 'false' : 'true'
80    });
81
82    //$(this).toggleClass('close-capa');
83    //$(this).toggleClass('open-capa');
84    $(this).toggleClass('rotated');
85    $(this).siblings('.closed').slideToggle();
86});
87
88$('.open-capa').on("keydown", function (ev) {
89    if (ev.key === 'Enter') {
90        ev.preventDefault();
91        $(this).attr('aria-expanded', function (i, attr) {
92            return attr == 'true' ? 'false' : 'true'
93        });
94
95        //$(this).toggleClass('close-capa');
96        //$(this).toggleClass('open-capa');
97        $(this).toggleClass('rotated');
98        $(this).siblings('.closed').slideToggle();
99    }
100});
101
102$('.close-capa').click(function () {
103    ev.preventDefault();
104    $(this).attr('aria-expanded', function (i, attr) {
105        return attr == 'true' ? 'false' : 'true'
106    });
107
108    $(this).toggleClass('close-capa');
109    $(this).toggleClass('open-capa');
110    $(this).toggleClass('rotated-close');
111});
112
113$('.close-capa').on("keydown", function (ev) {
114    if (ev.key === 'Enter') {
115        ev.preventDefault();
116        $(this).attr('aria-expanded', function (i, attr) {
117            return attr == 'true' ? 'false' : 'true'
118        });
119
120        $(this).toggleClass('close-capa');
121        $(this).toggleClass('open-capa');
122        $(this).toggleClass('rotated-close');
123    }
124});
125
126$('.closed-capa').click(function () {
127    $(this).toggleClass('rotated-close');
128    $(this).siblings('.closed-tab').slideToggle();
129});
130
131/*
132$(".open-capa").click(function() {
133    $(this).siblings('.closed').slideToggle();
134});
135
136$(".closed-capa").click(function() {
137    $(this).siblings('.closed-tab').slideToggle();
138});
139*/
140/* END DESPLEGAR PESTA�AS */
141
142/* LIMITAR CARACTERES */
143function ellipsis_box(elemento, max_chars) {
144    limite_text = $(elemento).text();
145    if (limite_text.length > max_chars) {
146        limite = limite_text.substr(0, max_chars) + "...";
147        $(elemento).text(limite);
148    }
149}
150$(function () {
151    ellipsis_box(".limitado", 70);
152});
153
154$(function () {
155    ellipsis_box(".limitado-large", 120);
156});
157
158/* DETECTA DISPOSITIVOS TACTILES */
159jQuery(document).ready(function () {
160    var isMobile = false;
161
162    if (navigator.userAgentData) {
163        isMobile = navigator.userAgentData.mobile;
164    }
165    else {
166        isMobile = {
167            Android: function () {
168                return navigator.userAgent.match(/Android/i);
169            },
170            BlackBerry: function () {
171                return navigator.userAgent.match(/BlackBerry/i);
172            },
173            iOS: function () {
174                return navigator.userAgent.match(/iPhone|iPad|iPod/i);
175            },
176            Opera: function () {
177                return navigator.userAgent.match(/Opera Mini/i);
178            },
179            Windows: function () {
180                return navigator.userAgent.match(/IEMobile/i);
181            },
182            any: function () {
183                return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
184            }
185        };
186    }
187
188    if (isMobile) {
189        // alert('mobile device');
190        jQuery('body').addClass('mobile-tactil');
191        jQuery('.selectLargo').addClass('hselect-mb');
192    };
193});
194
195/* TABLAS RESPONSIVE */
196var headertext = [];
197var headers = document.querySelectorAll(".table-responsive thead");
198var tablebody = document.querySelectorAll(".table-responsive tbody");
199
200for (var i = 0; i < headers.length; i++) {
201    headertext[i] = [];
202    for (var j = 0, headrow; headrow = headers[i].rows[0].cells[j]; j++) {
203        var current = headrow;
204        headertext[i].push(current.textContent);
205    }
206}
207
208for (var h = 0, tbody; tbody = tablebody[h]; h++) {
209    for (var i = 0, row; row = tbody.rows[i]; i++) {
210        for (var j = 0, col; col = row.cells[j]; j++) {
211            col.setAttribute("data-th", headertext[h][j]);
212        }
213    }
214}
215
216/*Oculta el icono de la flecha derecha del submenu izquierdo*/
217$('.main-menu li:has(ul)').mouseover(function (e) {
218    $('.sub-nav a span').removeClass('glyphicon-menu-right');
219});
220
221/*Menu desplegable al pulsar la flechita izquierda*/
222$(document).ready(function () {
223    var nav = function () {
224        $('.gw-nav > li >
224 a.btn_Menu').click(function () {
225            var gw_nav = $('.gw-nav');
226            gw_nav.find('li').removeClass('active');
227            $('.gw-nav > li > ul > li').removeClass('active');
228
229            var checkElement = $(this).parent();
230            var ulDom = checkElement.find('.gw-submenu')[0];
231
232            if (ulDom == undefined) {
233                checkElement.addClass('active');
234                $('.gw-nav').find('li > span').find('ul:visible').slideUp();
235                return;
236            }
237            if (ulDom.style.display != 'block') {
238                gw_nav.find('li').find('ul:visible').slideUp();
239
240                checkElement.addClass('active');
241                $('.gw-nav').find('li.active > .arrow-down').removeClass('arrow-down').addClass('init-arrow-down');
242                $('.gw-nav').find('li > .arrow-up').removeClass('arrow-up').addClass('arrow-down');
243                $('.gw-nav').find('li.active > .init-arrow-down').removeClass('init-arrow-down').addClass('arrow-up');
244
245                checkElement.find('ul').slideDown(300);
246            } else {
247                checkElement.removeClass('active');
248                $('.gw-nav').find('li> .arrow-up').removeClass('arrow-up').addClass('arrow-down ');
249
250                checkElement.find('ul').slideUp(300);
251            }
252        });
253
254        $('.gw-nav > li > a.btnMenuHover').click(function (e) {
255            var gw_nav = $('.gw-nav');
256            gw_nav.find('li').removeClass('active');
257            $('.gw-nav > li > ul > li').removeClass('active');
258
259            if (!$(".opacity-bg").hasClass("black-bg")) {
260                $('#maincontent').removeClass('disabled-menu');
261            }
262
263            $('.gw-nav > li .gw-submenu ').attr("aria-expanded", false);
264
265            var checkElement = $(this).parent();
266            var ulDom = checkElement.find('.gw-submenu')[0];
267
268            if (ulDom == undefined) {
269                checkElement.addClass('active');
270                $('.gw-nav').find('li > span').find('ul:visible').slideUp();
271                return;
272            }
273            if (ulDom.style.display != 'block') {
274                gw_nav.find('li').find('ul:visible').slideUp();
275
276                checkElement.addClass('active');
277                $('.gw-nav').find('li.active > .arrow-down').removeClass('arrow-down').addClass('init-arrow-down');
278                $('.gw-nav').find('li > .arrow-up').removeClass('arrow-up').addClass('arrow-down');
279                $('.gw-nav').find('li.active > .init-arrow-down').removeClass('init-arrow-down').addClass('arrow-up');
280
281                checkElement.find('ul').slideDown(3);
282                $('#maincontent').addClass('disabled-menu');
283
284                checkElement.find('ul').attr("aria-expanded", true);
285            } else {
286                checkElement.removeClass('active');
287                $('.gw-nav').find('li> .arrow-up').removeClass('arrow-up').addClass('arrow-down ');
288
289                checkElement.find('ul').slideUp(3);
290            }
291            e.stopPropagation();
292        });
293
294        $('.gw-nav > li > ul > li > a').click(function () {
295            $(this).parent().parent().parent().removeClass('active');
296            $('.gw-nav > li > ul > li').removeClass('active');
297            $(this).parent().addClass('active');
298        });
299    };
300    nav();
301
302    //HOVER para recorrer el menú
303    /*$('.gw-nav > li.init-arrow-down').hover(function () {
304        $(this).find("a.btnMenuHover").click();
305    });*/
306
307    //OCULTAR MENU - Pinchar fuera del menú
308    //$('footer, header, #maincontent').click(function () {
309    $(document).click(function () {
310        if ($(window).width() > 766) {
311            var gw_nav = $('.gw-nav');
312            gw_nav.find('li').removeClass('active');
313            $('.gw-nav > li > ul > li').removeClass('active');
314
315            if (!$(".opacity-bg").hasClass("black-bg")) {
316                $('#maincontent').removeClass('disabled-menu');
317            }
318
319            $('.gw-submenu.menu-cols').hide();
320
321            $('.gw-nav > li .gw-submenu ').attr("aria-expanded", false);
322        }
323    });
324
325    //OCULTAR EL MENU AL REDIMENSIONAR LA PANTALLA
326    //$(window).on('orientationchange resize', function () {
327    $(window).on('orientationchange', function () {
328        var gw_nav = $('.gw-nav');
329        gw_nav.find('li').removeClass('active');
330        $('.gw-nav > li > ul > li').removeClass('active');
331        $('#maincontent').removeClass('disabled-menu');
332        $('.gw-submenu.menu-cols').hide();
333    });
334});
335
336// JavaScript Document
337/* Llamada a las funciones */
338
339if (navigator.userAgent.search(/msie/i) > 0) {
340    funciones();
341} else {
342    document.addEventListener("DOMContentLoaded", funciones, false);
343}
344
345function funciones() {
346    DatosIniciales();
347}
348
349/* __________________________________________________ */
350
351function DatosIniciales() {
352    var ListaVinculos = document.links;
353    var TotalVinculos = ListaVinculos.length;
354    var SubListaVinculos = new Array(); // Subgrupo de los v�nculos que nos interesan
355    var z = 0;
356    for (n = 0; n < TotalVinculos; n++) {
357        if ((ListaVinculos[n].attributes.rel != null) && ((ListaVinculos[n].attributes.rel.value.search(/popup/i) >= 0) || (ListaVinculos[n].attributes.rel.value.search(/nueva/i) >= 0))) {
358            SubListaVinculos[z] = ListaVinculos[n];
359            z++;
360        }
361    }
362    AsignarEscuchas(SubListaVinculos);
363}
364
365function AsignarEscuchas(vinculos) {
366    vinculos.forEach(vinculo => {
367        vinculo.addEventListener("click", GeneradorDeVentanas);
368    });
369}
370
371function GeneradorDeVentanas(evento) {
372    if (this.getAttribute) {
373        var pagina = this.getAttribute('href');
374        var propiedades = this.getAttribute('rel').split("-");
375        var url = this.getAttribute('name');
376        //alert (propiedades);
377        evento.preventDefault();
378    } else {
379        var uri = evento.srcElement.getAttribute('href');
380        var subpagina = evento.srcElement.getAttribute('href').split("/");
381        var pagina = subpagina[subpagina.length - 1];
382        var propiedades = evento.srcElement.getAttribute('rel').split("-");
383    }
384    if (propiedades[0] == "popup") {
385        var popup = window.open(pagina, "VentanaEmergente", "width=" + propiedades[1] + ", height=" + propiedades[2] + ",status=" + propiedades[3] + ",scrollbars=" + propiedades[4] + ",location=" + propiedades[8] + ",toolbar=" + propiedades[9] + "directories=" + propiedades[10] + ",=" + propiedades[5] + ",menubar=" + propiedades[6] + ",resizable=" + propiedades[7] + '"');
386
387        //alert (popup);
388        return false; // previene que se cargue la pagina en el explorer
389    }
390    if (propiedades[0] == "nueva") {
391        var ancho = (screen.width / 1.2);
392        var alto = (screen.height / 1.3);
393        var PropiedadesVentanaNueva = "width=" + ancho + ",height=" + alto + ",status=" + propiedades[1] + ",scrollbars=" + propiedades[2] + ",toolbar=" + propiedades[3] + ",menubar=" + propiedades[4] + ",location=" + propiedades[5] + ",resizable=" + propiedades[6];
394        if (navigator.userAgent.search(/msie/i) > 0) {
395            var NuevaVentana = window.open(uri, "VentanaNueva", PropiedadesVentanaNueva);
396        } else {
397            var NuevaVentana = window.open(pagina, "VentanaNueva", PropiedadesVentanaNueva);
398        }
399
400        //NuevaVentana.moveTo(0, 0);
401
402        return false; // previene que se cargue la p�gina en el explorer
403    }
404}
405
406/* __________________________________________________*/
407
408jQuery("#close_window").on("click", function () {
409    window.close();
410});
411
412function getParameterByName(name) {
413    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
414    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
415        results = regex.exec(location.search);
416    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
417}
418
419/*Botones sociales compartir enlace ventana emergente*/
420$(document).ready(function () {
421    var lba = document.getElementsByClassName("social-button")
422
423    function myPopup() {
424        window.open(this.href, 'mywin',
425            'left=20,top=20,width=500,height=500,toolbar=1,menubar=no,resizable=no, status=no,titlebar=no');
426
427        event.preventDefault();
428        return false;
429    }
430
431    for (var i = 0; i < lba.length; i++) {
432        lba[i].addEventListener("click", myPopup, false);
433    }
434});
435
436/* COOKIES */
437function setCookie(cname, cvalue, exdays = 365) {
438    const d = new Date();
439    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
440    let expires = "expires=" + d.toUTCString();
441    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
442}
443
444function getCookie(cname) {
445    let name = cname + "=";
446    let ca = document.cookie.split(';');
447    for (let i = 0; i < ca.length; i++) {
448        let c = ca[i];
449        while (c.charAt(0) == ' ') {
450            c = c.substring(1);
451        }
452        if (c.indexOf(name) == 0) {
453            return c.substring(name.length, c.length);
454        }
455    }
456    return "";
457}
458
459function showCookiesPolicy() {
460    document.querySelector('#ctl00_WucCookiesPolicy_blockCookies')?.classList.remove('d-none');
461    document.querySelector("button[data-bs-target='#cookiesConfig']")?.click();
462}
463
464$(document).ready(function () {
465    const enlace = getCookie('tipoEnlace');
466
467    if (enlace === 'enlaceWeb') {
468        $("a").removeClass('enlaceNormal');
469        setCookie('tipoEnlace', 'enlaceWeb');
470        $('#' + enlace).prop('checked', true);
471    } else if (enlace === 'enlaceNormal') {
472        $("a").addClass('enlaceNormal');
473        setCookie('tipoEnlace', 'enlaceNormal');
474        $('#' + enlace).prop('checked', true);
475    } else {
476        $('#enlaceWeb').prop('checked', true);
477        setCookie('tipoEnlace', 'enlaceWeb');
478    }
479
480    $('input:radio').click(function () {
481        const selectedElement = $('input:radio:checked').attr('id');
482        if (selectedElement === 'enlaceNormal') {
483            $("a").addClass('enlaceNormal').removeClass('enlaceWeb');
484            setCookie('tipoEnlace', 'enlaceNormal');
485        } else {
486            $("a").removeClass('enlaceNormal').addClass('enlaceWeb');
487            setCookie('tipoEnlace', 'enlaceWeb');
488        }
489    });
490});
491
492/* Cookies End */

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.