PageSourceSearch

https://www.utp.edu.pe/web/themes/utp/js/global.js?v=10.6.2

js utp.edu.pe collected 2026-10-02 06:16:20 UTC 7,220 bytes, 199 lines download raw bytes

1// ATTACHING SEARCH BLOCK IN THE BANNER
2// var insertarBloqueBuscador = document.querySelector('#buscador-wrapper');
3// if (insertarBloqueBuscador) {
4//   insertarBloqueBuscador.prepend(document.querySelector('#block-buscadorbanner'));
5// }
6
7// MODAL ISSUU
8// const btnIssuu1 = document.querySelector('.btn-field-issuu-1');
9// const btnIssuu2 = document.querySelector('.btn-field-issuu-2');
10// if (btnIssuu1) {
11//   btnIssuu1.addEventListener('click', (e) => {
12//     // e.preventDefault();
13//     // document.querySelector('.wrapper-content-issuu').insertAdjacentHTML('beforeend', e.target.getAttribute("data-issuu"));
14//     UIkit.modal("#modal-alert-choose-brochure").show();
15//   });
16// }
17// if (btnIssuu2) {
18//   btnIssuu2.addEventListener('click', (e) => {
19//     // e.preventDefault();
20//     // document.querySelector('.wrapper-content-issuu').insertAdjacentHTML('beforeend', e.target.getAttribute("data-issuu"));
21//     UIkit.modal("#modal-alert-choose-brochure").show();
22//   });
23// }
24
25// const btnIssuu = document.querySelector('.btn-field-issuu');
26// if (btnIssuu) {
27//   btnIssuu.addEventListener('click', (e) => {
28//     e.preventDefault();
29//     // document.querySelector('.wrapper-content-issuu').insertAdjacentHTML('beforeend', e.target.getAttribute("data-issu"));
30//     UIkit.modal("#modal-alert-choose-brochure").show();
31//   });
32// }
33
34// UIkit.util.on('#modal-issuu', 'hide', function () {
35//   document.querySelector('.wrapper-content-issuu').innerHTML = '';  
36// });
37
38const btnChooseModal = document.querySelector('.btn-field-issuu-nuevo');
39const btnChooseModal2 = document.querySelector('.descarga-malla-nuevo');
40if (btnChooseModal) {
41  btnChooseModal.addEventListener('click', (e) => {
42    e.preventDefault();
43    UIkit.modal("#modal-alert-choose-brochure").show();
44  });
45}
46if (btnChooseModal2) {
47  btnChooseModal2.addEventListener('click', (e) => {
48    e.preventDefault();
49    UIkit.modal("#modal-alert-choose-malla").show();
50  });
51}
52
53UIkit.util.on('#modal-laboratorios-videos', 'hide', function () {
54  document.querySelector('#wrapper-insert-laboratorio').innerHTML = '';
55});
56UIkit.util.on('#modal-galeria-imagenes', 'hide', function () {
57  document.querySelector('.galeria-imagen img').src = '';
58  document.querySelector('.galeria-caption').innerHTML = '';  
59});
60
61
62// window.onscroll = function() {
63//   var y = window.scrollY;
64//   if(document.querySelector('#block-bloquesolicita') ){
65//     if(y >= 4175){document.querySelector('#block-bloquesolicita').classList.add('hidden')}
66//     else{document.querySelector('#block-bloquesolicita').classList.remove('hidden')}
67//   }
68// };
69
70
71window.addEventListener("beforeunload", function (e) {
72
73});
74
75
76
77// var radiosSedes = document.querySelectorAll('input[name="sedes"]');
78// for (i = 0; i < radiosSedes.length; i++) {
79//   radiosSedes[i].type = "checkbox";
80// }
81
82
83   //Seteo por defecto segun unidad de negocio
84   let pathActualS = location.pathname;  
85   let unidadNegocioParaMenu = 'PRESE';
86   if(pathActualS.includes('cgt') || pathActualS.includes('carreras-para-gente-trabaja')){
87     unidadNegocioParaMenu = '5050';
88     setTimeout(() => {
89      document.querySelectorAll('#block-utp-main-menu > ul > li:nth-child(9) .dropdown-item:not(.dropdown) a').forEach(element => {
90        element.setAttribute('href',element.getAttribute('href')+'/cgt')
91       });
92     }, 500);
93
94
95   }
96   if(pathActualS.includes('carreras-a-distancia')){
97     unidadNegocioParaMenu = 'VIRT';
98     setTimeout(() => {
99       document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(2) > ul > li:nth-child(3)').classList.add('hidden')
100       document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(2) > ul > li:nth-child(4) > a').textContent = 'Examen de admisión'
101     }, 500);
102   }
103// Filtro de carreras
104   let sedesCodUrl = [
105     {
106       "CODCRMSEDE": "LIATE",
107       "URLSEDE": "/ate"
108     },
109     {
110       "CODCRMSEDE": "LIMA",
111       "URLSEDE": "/lima-centro"
112     },
113     {
114       "CODCRMSEDE": "LIMAN",
115       "URLSEDE": "/lima-norte"
116     },
117     {
118       "CODCRMSEDE": "AREQU",
119       "URLSEDE": "/arequipa"
120     },
121     {
122       "CODCRMSEDE": "CHICL",
123       "URLSEDE": "/chiclayo"
124     },
125     {
126       "CODCRMSEDE": "CHIMB",
127       "URLSEDE": "/chimbote"
128     },
129     {
130       "CODCRMSEDE": "HUANC",
131       "URLSEDE": "/huancayo"
132     },
133     {
134       "CODCRMSEDE": "ICA",
135       "URLSEDE": "/ica"
136     },
137     {
138       "CODCRMSEDE": "LIMAS",
139       "URLSEDE": "/lima-sur"
140     },
141     {
142       "CODCRMSEDE": "PIURA",
143       "URLSEDE": "/piura"
144     },
145     {
146       "CODCRMSEDE": "LISJL",
147       "URLSEDE": "/sjl"
148     },
149     {
150       "CODCRMSEDE": "TRUJI",
151       "URLSEDE": "/trujillo"
152     }
153   ];
154
155
156   for (let i = 0; i < sedesCodUrl.length; i++) {
157     if(window.location.href.includes(sedesCodUrl[i].URLSEDE)){
158             fetch('/api/get-carreras-sedes')
159             .then(value => value.json())
160             .then((value)=>{
161              //console.log(value[unidadNegocioParaMenu][sedesCodUrl[i].CODCRMSEDE]);
162               return value[unidadNegocioParaMenu][sedesCodUrl[i].CODCRMSEDE];
163             }).then( carrs => {
164               let carrerasEnMenu = document.querySelectorAll('#block-utp-main-menu > ul > li:nth-child(4) .dropdown-item:not(.dropdown) a');
165               if(window.location.href.includes('cgt')){
166                 carrerasEnMenu = document.querySelectorAll('#block-utp-main-menu > ul > li:nth-child(5) .dropdown-item:not(.dropdown) a');
167               }
168
169               carrerasEnMenu.forEach(
170                   element => {
171                       element.parentNode.classList.add('hidden');
172                       element.setAttribute('href', sedesCodUrl[i].URLSEDE + element.getAttribute('href'))
173                       element.parentNode.parentNode.parentNode.classList.add('hidden')
174                       if(element.parentNode.parentNode.parentNode.classList.contains('esta-ensede')){
175                         element.parentNode.parentNode.parentNode.classList.remove('hidden');
176                       }
177                       const resultado =  carrs.find( carr => carr.carrera === element.innerHTML)
178                       if(resultado){
179                         element.parentNode.classList.remove('hidden');
180                         element.parentNode.parentNode.parentNode.classList.add('esta-ensede');
181                         element.parentNode.parentNode.parentNode.classList.remove('hidden');
182                       }
183                   }
184               )
185             } )
186         }
187     }
188
189     setTimeout(() => {
190      if(window.location.href.includes('carreras-a-distancia')){
191        if(document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(1)')){
192          document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(1)').classList.add('hidden')
193        }
194
195        if(document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(2) > ul > li:nth-child(2)')){
196          document.querySelector('#block-utp-main-menu > ul > li:nth-child(3) > ul > li:nth-child(2) > ul > li:nth-child(2)').classList.add('hidden')
197        }
198      }
199     }, 2500);

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.