PageSourceSearch

https://upaep.mx/templates/language/js/helper.js?v=1790241173

js upaep.mx collected 2026-09-24 09:13:09 UTC 3,501 bytes, 95 lines download raw bytes

1const getLanguageChangeButtonToUrl = () => {
2    const button_language = document.querySelector(".upaep__button__language");
3    const language = button_language.dataset.language;
4    const type = (language == 'EN') ? 'es' : (language == 'ES') ? 'en' : 'es';
5    let url_actual = window.location.href;
6    let url_actual_sin_type = url_actual.replaceAll("#es", "").replaceAll("#en", "");
7    window.history.pushState({}, document.title, `${url_actual_sin_type}#${type}`);
8    window.location.reload(true);
9    getChangeURLTaga();
10}
11
12const getLanguageActive = () => {
13    const url_upaep = new URL(window.location)
14    let lang = (window.location.hash == '#es') ? '#es' : (window.location.hash == '#en') ? '#en' : '#es';
15    return lang.replace('#', '').toUpperCase();
16}
17
18const getLanguageChangeButton = () => {
19    let lang = window.location.hash || "#es";
20    const icon = (lang == '#es') ? 
20"icon_en.svg" : (lang == '#en') ? "icon_es.svg" : "icon_en.svg";
21    const icon_m = (lang == '#es') ? 
21"icon_en_blanco.svg" : (lang == '#en')
21 ? "icon_es_blanco.svg" : "icon_en_blanco.svg";
22    const language = (lang == '#es') ? "ES" : (lang == '#en') ? "EN" : "ES";
23    const button_language = document.querySelector(".upaep__button__language");
24    const template = button_language.dataset.path;
25    button_language.setAttribute("data-language", language);
26    button_language.querySelector(".escritorio").src = `https://upaep.mx/templates/${template}/img/${icon}`;
27    button_language.querySelector(".movil").src = `https://upaep.mx/templates/${template}/img/${icon_m}`;
28    button_language.style.display = "block";
29}
30
31// Cambia los a acorde al idioma
32window.onload = () => { getChangeURLTaga(); };
33
34const getChangeURLTaga = () => {
35    console.log('url tags')
36    let lang = window.location.hash;
37    if (lang == '#en') {
38        var links = document.getElementsByTagName("a");
39        for (const link of links) {
40            if (link.href != '') {
41                if (link.href == 'https://upaep.mx/') {
42                    link.href = '/en';
43                } else {
44                    let idioma = getAlias(link.href);
45                    link.href = link.href.replace(link.href, `${link.href}${idioma}`);
46                }
47            }
48        }
49    }
50}
51
52// Funcion  que cambia el lang acorde al alias
53const getAlias = (url) => {
54    const englishPaths = [
55        "/adn",
56        "/internacionalizacion",
57        "/nosotros",
58        "/admisiones",
59        "/becas",
60        "/laudex",
61        "/claustro-de-profesores",
62        "/proyectos-de-impacto",
63        "/online",
64        "/abierta",
65        "/maestrias",
66        "/licenciatura",
67        "/licenciaturas",
68        "/doctorados",
69        "/doctorado",
70        "/especialidades",
71        "/especialidad",
72        "/pase-directo",
73        "/calculadora",
74        "/recorridovirtual/v1/",
75        "/recorridovirtual/v3/ubicacion/index.htm?media-index=1&sct=menu_ubica_residencias",
76        "/recorridovirtual/v3/ubicaciones/index.htm?media-index=1&sct=menu_ubica_residencias",
77        "/recorridovirtual/v3/ubicacion/",
78        "/fiderh",
79        "/residencias",
80        "/facultyled",
81        "/bridgeprogram",
82        "/intercambionacional",
83        "/hyflex",
84        "/alumni",
85    ];
86    if (url.includes('#en') || url.includes('?lang=en')) {
87        return "";
88    }
89    if (englishPaths.some(path => url.includes(path))) {
90        return "#en";
91    } else if (url.includes("upaep.mx")) {
92        return "?lang=en";
93    }
94    return "";
95}

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.