PageSourceSearch

https://esclerosismultiple.com/wp-content/themes/em/js/funciones.js?ver=7.1.2

js esclerosismultiple.com collected 2026-10-02 14:38:42 UTC 34,195 bytes, 1,008 lines download raw bytes

1jQuery(function ($) {
2    // Global Vars
3    var timer;
4    var x;
5    var predPosition = 0;
6
7    /**
8     * Mover cuadro newsletter en home
9     */
10    if ($("body").hasClass("home")) {
11        $("body.home footer > section#cd-news-footer-gaep").appendTo(
12            "body.home section.elementor-element-5256a2e"
13        );
14    }
15
16    /*
17     ** Botones que hacemos home
18     */
19    $(".btn-qhacemos a").click(function () {
20        idPadre = $(this).parents(".btn-qhacemos").attr("id");
21
22        // IMG
23        $(".btn-qhacemos").each(function (index) {
24            id = $(this).attr("id");
25            url_imagen = "/wp-content/themes/em/img/" + id + "-g.png";
26            $(this).find("img").attr("src", url_imagen);
27        });
28
29        url_imagen = "/wp-content/themes/em/img/" + idPadre + "-n.png";
30        $("#" + idPadre + " img").attr("src", url_imagen);
31
32        $(".btn-qhacemos").removeClass("btn-qhacemos-activo");
33        $(this).parents(".btn-qhacemos").addClass("btn-qhacemos-activo");
34
35        // Informacion
36        $(".sec-info-qhacemos").removeClass("sec-info-qhacemos-activa");
37        $("#info-" + idPadre).addClass("sec-info-qhacemos-activa");
38
39        return false;
40    });
41
42    /*
43     ** Buscador
44     */
45    //valorUsuario = "";
46    $(".buscador-header .campo-texto").keyup(function (e) {
47        let keyCode = String.fromCharCode(e.keyCode);
48        if (
49            /[a-zA-Z0-9-_ ]/.test(keyCode) ||
50            e.keyCode === 8 ||
51            e.keyCode === 46
52        ) {
53            if (x) {
54                x.abort();
55            } // If there is an existing XHR, abort it.
56            clearTimeout(timer); // Clear the timer so we don't end up with dupes.
57
58            //Cogemos las predicciones
59            let input = $(this).val();
60            let pressedKey = e.key;
61
62            // Pequeño timeout para evitar que busque a cada pulsacion
63            timer = setTimeout(function () {
64                $("div.buscador-header > form").addClass("cd-after-active");
65                coger_predicciones(input, pressedKey);
66            }, 300);
67        } else if (e.keyCode === 38 || e.keyCode === 40) {
68            // Teclas arriba y abajo (flechas)
69            moverse_en_predicciones(e.keyCode);
70        } else if (e.keyCode === 13) {
71            // Tecla intro
72            let predLength = $(
73                "#listado-predicciones.js-listado-predicciones li"
74            ).length;
75            let disabled = $(
76                "#listado-predicciones.js-listado-predicciones li:first-child"
77            ).data("disabled");
78            if (predLength && predLength > 0 && disabled !== "yes") {
79                e.preventDefault();
80                let text = $(
81                    "#listado-predicciones.js-listado-predicciones li.js-marca
81do"
82                ).text();
83
84                if (text != "") {
85                    $(".buscador-header .campo-texto").val(text);
86                }
87
88                $(
89                    '.buscador-header > form#cd-buscador input[type="submit"]'
90                ).click();
91
92                return false;
93            } else {
94                if (
95                    $(
96                        "#listado-predicciones.js-listado-predicciones li.js-marcado"
97                    ).length <= 0
98                ) {
99                    $(
100                        '.buscador-header > form#cd-buscador input[type="submit"]'
101                    ).click();
102                }
103            }
104        } else {
105            e.preventDefault();
106            return false;
107        }
108    });
109
110    // Controlamos que el cursor no cambie de posicion al moverse entre predicciones
111    $(".buscador-header .campo-texto").on("keydown", function (e) {
112        if (e.key === "ArrowUp" || e.key === "ArrowDown") return false;
113    });
114
115    // Controlamos que el al pulsar intro no se envia el formulario
116    $(".buscador-header .campo-texto").on("keyup keypress keydown", function (
117        e
118    ) {
119        if (e.keyCode === 13) {
120            // Tecla intro
121            let predLength = $(
122                "#listado-predicciones.js-listado-predicciones li"
123            ).length;
124            let disabled = $(
125                "#listado-predicciones.js-listado-predicciones li:first-child"
126            ).data("disabled");
127            if (predLength && predLength > 0 && disabled !== "yes") {
128                if (e.key === "Enter") return false;
129            } else {
130                if (
131                    $(
132                        "#listado-predicciones.js-listado-predicciones li.js-marca
132do"
133                    ).length <= 0
134                ) {
135                    if (
136                        $(
137                            "#listado-predicciones.js-listado-predicciones li.js-marcado"
138                        ).data("url")
139                    ) {
140                        let a = document.createElement("a");
141                        a.target = "_blank";
142                        a.href = $(
143                            "#listado-predicciones.js-listado-predicciones li.js-marcado"
144                        ).data("url");
145                        a.click();
146                        return false;
147                    }
148                    $(
149                        '.buscador-header > form#cd-buscador input[type="submit"]'
150                    ).click();
151                }
152            }
153        }
154    });
155
156    // Click en predicciones
157    $("#listado-predicciones").on("click", "li", function (e) {
158        if ($(this).data("url")) {
159            let a = document.createElement("a");
160            a.target = "_blank";
161            a.href = $(this).data("url");
162            a.click();
163            return false;
164        }
165
166        if (!$(this).attr("data-disabled")) {
167            $(".buscador-header .campo-texto").val($(this).text());
168            $(
169                '.buscador-header > form#cd-buscador input[type="submit"]'
170            ).click();
171        }
172    });
173
174    // Controlamos que cuando se pierda el focus en el buscador se oculte el listado de predicciones
175    $(".buscador-header .campo-texto").blur(function (e) {
176        //Quitamos la transparencia
177        $("div#cd-transparency-searcher").fadeOut("normal", () => {
178            $("div#cd-transparency-searcher").remove();
179        });
180
181        if (!$(e.relatedTarget).hasClass("js-prediccion-elemento")) {
182            $("#listado-predicciones.js-listado-predicciones").hide();
183        }
184    });
185
186    // Controlamos que cuando se hace focus en el buscador se muestre el listado de predicciones
187    $(".buscador-header .campo-texto").focus(function (e) {
188        // Oscurecemos todo
189        $("form#cd-buscador").css("z-index", "10000");
190        let html = `<div id="cd-transparency-searcher"></div>`;
191        $("body").append(html);
192        $("div#cd-transparency-searcher").fadeIn("normal");
193
194        let predLength = $("#listado-predicciones.js-listado-predicciones li")
195            .length;
196
197        if (predLength >= 1) {
198            $("#listado-predicciones.js-listado-predicciones").show();
199        }
200    });
201
202    // Limpiamos input de buscador al enviar el formulario
203    $("#masthead .buscador-header > form").submit(function (e) {
204        $(".buscador-header .campo-texto").val();
205        let str = $(".buscador-header .campo-texto").val();
206        str = str.replace(/[^a-z0-9áéíóúñü \.,_-]/gim, "");
207
208        $(e).val(str);
209    });
210
211    function coger_predicciones(input, pressedKey) {
212        let posicionListadoPrediccion = 0;
213        if (pressedKey !== "ArrowUp" && pressedKey !== "ArrowDown") {
214            // Saneamos tildes
215            input = input.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
216
217            data = {
218                nonce: ajax_var.nonce,
219                action: "coger_predicciones",
220                input: input,
221            };
222
223            x = $.ajax({
224                type: "POST",
225                dataType: "JSON",
226                url: ajax_var.url,
227                data: data,
228                success: function (data) {
229                    //console.log(data);
230                    let results = data.results;
231
232                    let html = ``;
233                    results.forEach(function (e) {
234                        // Si son redes sociales dirigimos automaticamente en los resultados predictivos
235                        let url = "";
236                        switch (e) {
237                            case "facebook":
238                                url =
239                                    "https://es-es.facebook.com/esclerosismultipleespana/";
240                                break;
241                            case "instagram":
242                                url =
243                                    "https://www.instagram.com/esclerosiseme/?hl=en";
244                                break;
245                            case "youtube":
246                                url =
247                                    "https://www.youtube.com/channel/UCTQcePkjNKigG93Wy_67qgw";
248                                break;
249                            case "twitter":
250                                url =
251                                    "https://twitter.com/esclerosiseme?lang=en";
252                                break;
253                            case "flickr":
254                                url =
255                                    "https://www.flickr.com/photos/felem/sets/";
256                                break;
257                            case "linkdin":
258                                url =
259                                    "https://es.linkedin.com/company/esclerosis-multiple-espana?trk=similar-pages_result-card_full-click";
260                                break;
261                        }
262
263                        html += `<li class="js-prediccion-elemento" tabindex="-1" ${
264                            url ? 'data-url="' + url + '"' : ""
265                        } ${
266                            data.status === "ko" ? 'data-disabled="yes"' : ""
267                        }>${e}</li>`;
268                    });
269
270                    $(".js-listado-predicciones").html(html);
271                    $(".js-listado-predicciones").show();
272                    $("div.buscador-header > form").removeClass(
273                        "cd-after-active"
274                    );
275
276                    // Reseteamos la posicion de las predicciones
277                    predPosition = 0;
278                },
279                error: function (error) {
280                    console.log(error);
281                },
282            });
283        }
284    }
285
286    function moverse_en_predicciones(keyCode) {
287        let predLength = $("#listado-predicciones.js-listado-predicciones li")
288            .length;
289
290        switch (keyCode) {
291            case 38:
292                if (predPosition > 1) {
293                    predPosition--;
294                }
295                break;
296            case 40:
297                if (predPosition < predLength) {
298                    predPosition++;
299                }
300                break;
301            default:
302                return false;
303        }
304
305        $("#listado-predicciones.js-listado-predicciones li").removeClass(
306            "marcado"
307        );
308        $(
309            "#listado-predicciones.js-listado-predicciones li:nth-child(" +
310            predPosition +
311            ")"
312        ).addClass("marcado");
313
314        $("#listado-predicciones.js-listado-predicciones li").removeClass(
315            "js-marcado"
316        );
317        $(
318            "#listado-predicciones.js-listado-predicciones li:nth-child(" +
319            predPosition +
320            ")"
321        ).addClass("js-marcado");
322    }
323
324    // Sidebar accordion
325    $(".js-cd-desplegar-sidebar").click(function (e) {
326        $(".cd-accordion-sidebar-em").each(function (k, v) {
327            $(this).find("ul").slideUp("normal");
328        });
329
330        if ($(this).parent().find("ul").css("display") === "block") {
331            $(this).parent().find("ul").slideUp("normal");
332        } else {
333            $(this).parent().find("ul").slideDown("normal");
334        }
335    });
336
337    if ($(".cd-container-em").length > 0) {
338        let topLimit = $(".cd-container-em__inner").offset().top - 150;
339        $(window).scroll(function () {
340            if (topLimit <= $(window).scrollTop()) {
341                $(
342                    ".cd-container-em__inner #sidebar .cd-main-sidebar-em"
343                ).addClass("stickIt");
344                $(".cd-container-em__inner #sidebar .cd-main-sidebar-em").css(
345                    "width",
346                    $(".cd-container-em__inner #sidebar").width()
347                );
348            } else {
349                $(
350                    ".cd-container-em__inner #sidebar .cd-main-sidebar-em"
351                ).removeClass("stickIt");
352                $(".cd-container-em__inner #sidebar .cd-main-sidebar-em").css(
353                    "width",
354                    "inherit"
355                );
356            }
357        });
358
359        /*
360		$('.cd-main-sidebar-em > section.cd-section-sidebar-em > p > a').each(function(k,v){
361			$(this).attr('href', 'javascript:void())')
362		});
363		*/
364    }
365
366    // Links cuadrados home
367    $("body.home .cd-square-link-home .cd-square-link-home-1").click(function (
368        e
369    ) {
370        window.location.href =
371            "/esclerosis-multiple/que-es-la-esclerosis-multiple/";
372    });
373
374    $("body.home .cd-square-link-home .cd-square-link-home-2").click(function (
375        e
376    ) {
377        window.location.href = "/esclerosis-multiple/sintomas/";
378    });
379
380    $("body.home .cd-square-link-home .cd-square-link-home-3").click(function (
381        e
382    ) {
383        window.location.href =
384            "/esclerosis-multiple/tratamientos-de-la-esclerosis-multiple/";
385    });
386
387    $("body.home .cd-square-link-home .cd-square-link-home-4").click(function (
388        e
389    ) {
390        window.location.href = "/esclerosis-multiple/diagnostico/";
391    });
392
393    // Enlaces en nueva pestaña
394    if ($("body").hasClass("page-id-38")) {
395        $(".jet-team-member").each(function (k, v) {
396            $(this)
397                .find(
398                    ".jet-team-member__socials .jet-team-member__socials-item"
399                )
400                .each(function (k2, v2) {
401                    $(this).find("a").attr("target", "_blank");
402                });
403        });
404    }
405
406    $("#cd-donar-home-c > .cd-doner-home-ic > div > .donar-home-tab").click(
407        function (e) {
408            let type = $(this).data("active");
409            if (type === "puntual") {
410                let n1 = $(this)
411                    .parents("#cd-donar-home-c")
412                    .find(
413                        ".donar-home-inner-mensual > .js-change-donative-home > div:first-child"
414                    );
415                let n2 = $(this)
416                    .parents("#cd-donar-home-c")
417                    .find(
418                        ".donar-home-inner-mensual > .js-change-donative-home > div:nth-child(2)"
419                    );
420                let n3 = $(this)
421                    .parents("#cd-donar-home-c")
422                    .find(
423                        ".donar-home-inner-mensual > .js-change-donative-home > div:nth-child(3)"
424                    );
425
426                n1.html("<p>25€</p>");
427                n2.html("<p>50€</p>");
428                n3.html("<p>250€</p>");
429
430                n1.data("price", 25);
431                n2.data("price", 50);
432                n3.data("price", 250);
433            } else {
434                let n1 = $(this)
435                    .parents("#cd-donar-home-c")
436                    .find(
437                        ".donar-home-inner-mensual > .js-change-donative-home > div:first-child"
438                    );
439                let n2 = $(this)
440                    .parents("#cd-donar-home-c")
441                    .find(
442                        ".donar-home-inner-mensual > .js-change-donative-home > div:nth-child(2)"
443                    );
444                let n3 = $(this)
445                    .parents("#cd-donar-home-c")
446                    .find(
447                        ".donar-home-inner-mensual > .js-change-donative-home > div:nth-child(3)"
448                    );
449
450                n1.html("<p>12€</p>");
451                n2.html("<p>25€</p>");
452                n3.html("<p>50€</p>");
453
454                n1.data("price", 12);
455                n2.data("price", 25);
456                n3.data("price", 50);
457            }
458        }
459    );
460
461    $("#cd-donar-home-c > .cd-doner-home-ic > div > div.donar-home-tab").click(
462        function (e) {
463            if ($(this).hasClass("donacion-menusal")) {
464                $(this).addClass("donar-home-tab-active");
465                $(
466                    "#cd-donar-home-c > .cd-doner-home-ic > div > div.donar-home-tab.donacion-puntual"
467                ).removeClass("donar-home-tab-active");
468            } else {
469                $(this).addClass("donar-home-tab-active");
470                $(
471                    "#cd-donar-home-c > .cd-doner-home-ic > div > div.donar-home-tab.donacion-menusal"
472                ).removeClass("donar-home-tab-active");
473            }
474        }
475    );
476
477    /*
478    $(".dona-header > a").click(function (e) {
479        if ($(window).width() >= 767) {
480            e.preventDefault();
481            $("#cd-donation-form-slide-home").addClass("slideactive");
482        }
483    });
484    */
485
486    $(".cd-donation-slide-close").click(function (e) {
487        $("#cd-donation-form-slide-home").removeClass("slideactive");
488    });
489
490    $(
491        "body.page-id-19809 div#linea-opciones-destino label:last-child input"
492    ).click();
493    $("body.page-id-19809 div#linea-opciones-destino").hide();
494
495    $(
496        "body.page-id-11754 div#linea-opciones-destino label:last-child input"
497    ).click();
498    $("body.page-id-11754 div#linea-opciones-destino").hide();
499
500    $("body.page-id-16822 div#linea-opciones-destino").hide();
501
502    // marcamos empresas en la donacion en la pagina de empresas por defecto
503    $(
504        'body.page-id-19076 #linea-opciones-paem input[name="particular"]'
505    ).click();
506
507    targetBlank();
508
509    // Newsletter
510    if ($("body.page-id-12019").length > 0) {
511        let email = getUrlParameter("c-news-email");
512        if (email && email != "") {
513            $("#opt_email").val(email);
514        }
515    }
516
517    // Enlace slider.
518    if ($("body.home div#rev_slider_13_1")) {
519        $("body.home div#rev_slider_13_1").css('cursor', 'pointer');
520
521        $("body.home div#rev_slider_13_1").click(() => {
522            $("body.home div#rev_slider_13_1").css('cursor', 'pointer');
523            window.open("https://elfantasmadelaem.org/", "_blank");
524        });
525    }
526
527    // Slider en la home 4 apartados
528    $(document).ready(function () {
529        if (document.querySelector("#botones-que-hacemos")) {
530            document
531                .querySelector("#botones-que-hacemos > div")
532                .classList.add("swiper-container");
533            document
534                .querySelector("#botones-que-hacemos > div > div")
535                .classList.add("swiper-wrapper");
536            document
537                .querySelectorAll("#botones-que-hacemos > div > div > div")
538                .forEach((item) => {
539                    item.classList.add("swiper-slide");
540                });
541
542            let prev = document.createElement("div");
543            prev.classList.add("swiper-button-prev");
544
545            let next = document.createElement("div");
546            next.classList.add("swiper-button-next");
547
548            document.querySelector("#botones-que-hacemos > div").append(prev);
549            document.querySelector("#botones-que-hacemos > div").append(next);
550
551            var mySwiper = new Swiper(".swiper-container", {
552                // Optional parameters
553                direction: "horizontal",
554                loop: false,
555                slidesPerView: 5,
556                // Responsive breakpoints
557                breakpoints: {
558                    // when window width is >= 320px
559                    1024: {
560                        slidesPerView: 3,
561                    },
562                    // when window width is >= 480px
563                    600: {
564                        slidesPerView: 2,
565                    },
566                },
567                // Navigation arrows
568                navigation: {
569                    nextEl: ".swiper-button-next",
570                    prevEl: ".swiper-button-prev",
571                },
572            });
573
574            /*
575		$('body.home #botones-que-hacemos > div > div').slick({
576			dots: false,
577			infinite: false,
578			slidesToShow: 5,
579			slidesToScroll: 5,
580			responsive: [
581				{
582					breakpoint: 1024,
583					settings: {
584						slidesToShow: 3,
585						slidesToScroll: 3,
586						infinite: false,
587						dots: false,
588						arrows: true
589					}
590				},
591				{
592					breakpoint: 600,
593					settings: {
594						slidesToShow: 2,
595						slidesToScroll: 2,
596						infinite: false,
597						dots: false,
598						arrows: true
599					}
600				},
601				{
602					breakpoint: 480,
603					settings: {
604						slidesToShow: 1,
605						slidesToScroll: 1,
606						infinite: false,
607						dots: false,
608						arrows: true
609					}
610				}
611				// You can unslick at a given breakpoint now by adding:
612				// settings: "unslick"
613				// instead of a settings object
614			]
615		});
616		*/
617        }
618    });
619
620    // Filtro de noticias de EME
621    if ($("#filtros-noticias")) {
622        let disabledCategories = [
623            "280",
624            "1",
625            "601",
626            "47",
627            "633",
628            "408",
629            "282",
630            "56",
631            "62",
632            "52",
633            "625",
634            "63",
635        ];
636        $("select#ofcategory > option").each((k, v) => {
637            if (disabledCategories.includes($(v).val())) {
638                // Ponemos las ids de las categorias que no queremos que salgan
639                $(v).remove();
640            }
641        });
642    }
643});
644
645function targetBlank() {
646    // remove subdomain of current site's url and setup regex
647    let internal = location.host.replace("www.", "");
648    internal = new RegExp(internal, "i");
649
650    var a = document.getElementsByTagName("a"); // then, grab every link on the page
651    for (let i = 0; i < a.length; i++) {
652        let href = a[i].host; // set the host of each link
653        if (href !== "") {
654            if (!internal.test(href)) {
655                // make sure the href doesn't contain current site's host
656                a[i].setAttribute("target", "_blank"); // if it doesn't, set attributes
657            }
658        }
659    }
660}
661
662jQuery(window).load(function () {
663    //Fix menu
664    jQuery(window).scroll(() => {
665        if (
666            jQuery(window).width() > 767 &&
667            jQuery("#mysticky-nav.wrapfixed").length > 0
668        ) {
669            jQuery("header#masthead").addClass("cd-fix-menu");
670        } else {
671            jQuery("header#masthead").removeClass("cd-fix-menu");
672        }
673    });
674
675    // Funcion para comprobar si tiene una busqueda en el resultado para poder hacer scroll
676    // ! Controla el Scroll cuándo hay resultados.
677
678    // Modificamos la funcion contains para que no tenga en cuenta tildes ni mayusculas
679    jQuery.expr[":"].contains = function (a, i, m) {
680        var rExps = [
681            {re: /[\xC0-\xC6]/g, ch: "A"},
682            {re: /[\xE0-\xE6]/g, ch: "a"},
683            {re: /[\xC8-\xCB]/g, ch: "E"},
684            {re: /[\xE8-\xEB]/g, ch: "e"},
685            {re: /[\xCC-\xCF]/g, ch: "I"},
686            {re: /[\xEC-\xEF]/g, ch: "i"},
687            {re: /[\xD2-\xD6]/g, ch: "O"},
688            {re: /[\xF2-\xF6]/g, ch: "o"},
689            {re: /[\xD9-\xDC]/g, ch: "U"},
690            {re: /[\xF9-\xFC]/g, ch: "u"},
691            {re: /[\xC7-\xE7]/g, ch: "c"},
692            {re: /[\xD1]/g, ch: "N"},
693            {re: /[\xF1]/g, ch: "n"},
694        ];
695
696        var element = jQuery(a).text();
697        var search = m[3];
698
699        jQuery.each(rExps, function () {
700            element = element.replace(this.re, this.ch);
701            search = search.replace(this.re, this.ch);
702        });
703
704        return element.toUpperCase().indexOf(search.toUpperCase()) >= 0;
705    };
706
707    // Funcion para buscar la cadena de busqueda en la pagina cross browser
708    function findString(str) {
709        let target = jQuery(
710            "h1.elementor-heading-title:contains('" + str + "'):first"
711        );
712
713        if (target.length <= 0) {
714            target = jQuery(
715                "h2.elementor-heading-title:contains('" + str + "'):first"
716            );
717        }
718
719        if (target.length <= 0) {
720            target = jQuery(
721                "h3.elementor-heading-title:contains('" + str + "'):first"
722            );
723        }
724
725        if (target.length <= 0) {
726            let pointer = 0;
727            targets = jQuery(
728                "div.elementor-text-editor:contains('" + str + "')"
729            );
730
731            targets.each(function (k, v) {
732                let fontSize = parseInt(
733                    jQuery(v).css("font-size").replace("px", "")
734                );
735                let color = jQuery(v).css("color");
736
737                if (fontSize >= 18 && color === "rgb(235, 72, 30)") {
738                    target = jQuery(v);
739                    return false;
740                }
741            });
742        }
743
744        if (target.length > 0) {
745            target.css("background", "yellow");
746            jQuery("html, body").animate(
747                {
748                    scrollTop: target.offset().top - 50,
749                },
750                1000
751            );
752        }
753    }
754
755    // Dirigimos al resultado si es una pagina de resultado y tiene la busqueda en la URL
756    let sBusqueda = getUrlParameter("b");
757    if (sBusqueda) {
758        let hayResultados = jQuery(
759            'div[data-ancla-busqueda="' + sBusqueda + '"]'
760        ).length;
761        if (hayResultados > 0) {
762            let target = jQuery('div[data-ancla-busqueda="' + sBusqueda + '"]');
763            let abrir = target.data("posicion-abrir");
764
765            if (abrir && abrir > 0) {
766                let targetInner = target.find(
767                    ".elementor-accordion-item:nth-child(" +
768                    abrir +
769                    ") > .elementor-tab-title"
770                );
771                jQuery("html, body")
772                    .animate(
773                        {
774                            scrollTop: targetInner.offset().top - 80,
775                        },
776                        500
777                    )
778                    .promise()
779                    .then(function () {
780                        targetInner.click();
781                    });
782            } else {
783                jQuery("html, body").animate(
784                    {
785                        scrollTop: target.offset().top - 50,
786                    },
787                    1000
788                );
789            }
790        } else {
791            findString(sBusqueda);
792        }
793    }
794});
795
796/**
797 *
798 * @param {string} sParam
799 */
800var getUrlParameter = function getUrlParameter(sParam) {
801    var sPageURL = window.location.search.substring(1),
802        sURLVariables = sPageURL.split("&"),
803        sParameterName,
804        i;
805
806    for (i = 0; i < sURLVariables.length; i++) {
807        sParameterName = sURLVariables[i].split("=");
808
809        if (sParameterName[0] === sParam) {
810            return sParameterName[1] === undefined
811                ? true
812                : decodeURIComponent(sParameterName[1]);
813        }
814    }
815};
816
817//// Publicaciones
818document.addEventListener("DOMContentLoaded", () => {
819    if (document.querySelector("body.page-id-597")) {
820        document
821            .querySelector("body.page-id-597 div#content")
822            .classList.remove("container");
823
824        let acc = document.querySelectorAll(".cd-a-accordion");
825        let i;
826
827        for (i = 0; i < acc.length; i++) {
828            acc[i].addEventListener("click", function () {
829                /* Toggle between adding and removing the "active" class,
830                to highlight the button that controls the panel */
831                this.classList.toggle("active");
832
833                /* Toggle between hiding and showing the active panel */
834                var panel = this.nextElementSibling;
835                if (panel.style.display === "block") {
836                    panel.style.display = "none";
837                } else {
838                    panel.style.display = "block";
839                }
840            });
841        }
842    }
843
844    if (document.querySelector("body.publicacion-template-default")) {
845        if (
846            document.querySelector(
847                "body.publicacion-template-default article > figure.post-thumbnail > img"
848            )
849        ) {
850            document
851                .querySelector(
852                    "body.publicacion-template-default article div.featured-text"
853                )
854                .classList.add("oaegiae1tt3");
855
856            const id = document.querySelector('article').id.replace(/^\D+/g, '');
857
858            jQuery.ajax({
859                url: 'https://esclerosismultiple.com/wp-content/themes/em/get-header-p.php',
860                data: {
861                    id: id,
862                    format: 'json'
863                },
864                error: function () {
865                    console.log('error - cd-1');
866                },
867                dataType: 'JSON',
868                success: function (data) {
869                    document.querySelector('div.oaegiae1tt3 > p').textContent = data;
870                    document.querySelector('div.oaegiae1tt3').style.display = 'block';
871                },
872                type: 'POST'
873            });
874
875        }
876    }
877
878    if (
879        document.querySelector(
880            "#elementor-tab-content-1341 > ol > li:nth-child(1) > span > a"
881        )
882    ) {
883        document
884            .querySelector(
885                "#elementor-tab-content-1341 > ol > li:nth-child(1) > span > a"
886            )
887            .addEventListener("click", (e) => {
888                e.preventDefault();
889                document.querySelector(
890                    "#elementor-tab-content-1341 > ol > li:nth-child(4)"
891                ).style.scrollMargin = "20px";
892                document
893                    .querySelector(
894                        "#elementor-tab-content-1341 > ol > li:nth-child(4)"
895                    )
896                    .scrollIntoView();
897            });
898    }
899
900   /* MOD: if (document.querySelector("#menu-item-20423 > a")) {
901        document
902            .querySelector("#menu-item-20423 > a")
903            .setAttribute("target", "_blank");
904        document
905            .querySelector("#menu-item-20420 > a")
906            .setAttribute("target", "_blank");
907        document
908            .querySelector("#menu-item-20421 > a")
909            .setAttribute("target", "_blank");
910        document
911            .querySelector("#menu-item-20422 > a")
912            .setAttribute("target", "_blank");
913    } */
914	
915	const menu20423 = document.querySelector("#menu-item-20423 > a");
916if (menu20423) menu20423.setAttribute("target", "_blank");
917
918const menu20420 = document.querySelector("#menu-item-20420 > a");
919if (menu20420) menu20420.setAttribute("target", "_blank");
920
921const menu20421 = document.querySelector("#menu-item-20421 > a");
922if (menu20421) menu20421.setAttribute("target", "_blank");
923
924const menu20422 = document.querySelector("#menu-item-20422 > a");
925if (menu20422) menu20422.setAttribute("target", "_blank");
926	
927	
928});
929
930////
931
932/**
933 * Analytics
934 */
935if (document.querySelector('div#cd-news-form-franja > form > input[type="submit"]')) {
936    document.querySelector('div#cd-news-form-franja > form > input[type="submit"]').addEventListener('click', e => {
937        __gaTracker('send', 'event', 'Inscripcion', 'Newsletter', 'Footer');
938    });
939}
940/****/
941
942document.addEventListener('DOMContentLoaded', () => {
943    let farmacologico = document.querySelector('.anchor-tratamiento-farmacologico');
944    if (farmacologico) {
945        const queryString = window.location.search;
946        const urlParams = new URLSearchParams(queryString);
947
948        if (queryString) {
949            const tratamiento = urlParams.get('tratamiento');
950            if (tratamiento === 'farmacologico') {
951                farmacologico.scrollIntoView();
952            } else {
953                document.querySelector('.anchor-tratamiento-rehabilitador').scrollIntoView();
954            }
955        }
956    }
957
958    // Slider proyecto M1 publicaciones
959
960    const swiper = new Swiper('.cd-gej81', {
961        // Optional parameters
962        direction: 'horizontal',
963        loop: true,
964        slidesPerView: 5,
965        spaceBetween: 45,
966        // Navigation arrows
967        navigation: {
968            nextEl: '.swiper-button-next',
969            prevEl: '.swiper-button-prev',
970        },
971    });
972
973    //slider flechas
974    if (document.getElementById('cd-agmi1t41')) {
975        const node = document.createElement('div');
976        node.setAttribute('id', 'cd-amgnj8i1tk410');
977        node.classList.add('swiper-button-prev');
978        const node2 = document.createElement('div');
979        node2.setAttribute('id', 'cd-amgnj8i1tk412');
980        node2.classList.add('swiper-button-next');
981        document.getElementById("cd-agmi1t41").prepend(node);
982        document.getElementById("cd-agmi1t41").appendChild(node2);
983
984        document.getElementById('cd-amgnj8i1tk410').addEventListener('click', e => {
985            document.querySelector('.cd-gej81 > div.swiper-button-prev').click();
986        });
987        document.getElementById('cd-amgnj8i1tk412').addEventListener('click', e => {
988            document.querySelector('.cd-gej81 > div.swiper-button-next').click();
989        });
990    }
991
992    // Bizum
993    if (document.querySelector('#cd-donar-main-form')) {
994        const queryString = window.location.search;
995        const urlParams = new URLSearchParams(queryString);
996        const particular = urlParams.get('paem');
997        const type = urlParams.get('type');
998
999        if (particular && particular === 'particular' && type && type === 'puntual') {
1000            document.querySelector('.cd-boton-donar-bizum').style.display = 'flex';
1001            document.querySelector('.cd-boton-donar-domiciliacion').style.flexBasis = '19%';
1002            document.querySelector('.cd-boton-donar-paypal').style.flexBasis = '19%';
1003            document.querySelector('.cd-boton-donar-bizum').style.flexBasis = '19%';
1004            document.querySelector('.cd-boton-donar-tarjeta').style.flexBasis = '19%';
1005        }
1006    }
1007
1008});

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.