PageSourceSearch

https://itb.edu.ec/statics/js/main.js

js itb.edu.ec collected 2026-09-24 10:27:19 UTC 10,839 bytes, 276 lines download raw bytes

1var carga=true;
2var mapasifrm = 0;
3let windowWidth = window.innerWidth;
4let lastScrollPosition = window.pageYOffset || document.documentElement.scrollTop;
5let lastScroll = 0;
6let ticking = false;
7window.addEventListener('resize',()=>{ windowWidth = window.innerWidth;});
8window.addEventListener('load',function(){
9    var scrollPosition = window.scrollY || window.pageYOffset;barraMenu(scrollPosition);
10});
11window.addEventListener('scroll', function() {
12    lastScroll = window.scrollY;
13    if (!ticking) {
14        window.requestAnimationFrame(function(){
15            barraMenu(lastScroll);
16            ticking = false;
17        });
18        ticking = true;
19    }
20    checkScrollDirection()
21});
22document.addEventListener('DOMContentLoaded', function(){
23    document.querySelectorAll('#navbarCollapseMenu .no-close').forEach(item => {
24        item.addEventListener('click',function(e){
25            e.stopPropagation();
26        });
27    });
28});
29
30function barraMenu(scroll){
31    if(scroll >= 300){
32        MoveMenu(true);
33        HideShowTop(true);
34        HideShowSocial(true);
35    }else{
36        MoveMenu(false);
37        HideShowTop(false);
38        HideShowSocial(true);
39    }
40}
41function checkScrollDirection(){
42    const currentScrollPosition = window.pageYOffset || document.documentElement.scrollTop;
43    if (currentScrollPosition > lastScrollPosition){
44        HideShowIcons(false);
45    }else{
46        HideShowIcons(true);
47    }
48    lastScrollPosition = currentScrollPosition;
49}
50
51function HideShowIcons(mostrar){
52    const discapacidadMenu = document.getElementById('discapacidad');
53    const whasapIcon = document.getElementById('whasapicon');
54    if(windowWidth < 768){
55        if(mostrar){
56            discapacidadMenu.classList.remove('animate__animated','animate__fadeOut');
57            discapacidadMenu.classList.add('animate__animated','animate__fadeIn');
58            discapacidadMenu.style.display = 'block';
59            whasapIcon.classList.remove('animate__animated','animate__fadeOut');
60            whasapIcon.classList.add('animate__animated','animate__fadeIn');
61            whasapIcon.style.display = 'block';
62        }else{
63            discapacidadMenu.classList.remove('animate__animated','animate__fadeIn');
64            discapacidadMenu.classList.add('animate__animated','animate__fadeOut');
65            discapacidadMenu.style.display = 'none';
66            whasapIcon.classList.remove('animate__animated','animate__fadeIn');
67            whasapIcon.classList.add('animate__animated','animate__fadeOut');
68            whasapIcon.style.display = 'none';
69        }
70    }
71}
72function MoveMenu(mostrar){
73    const navmenu = document.getElementById('navmenu');
74    if(mostrar){
75        navmenu.style.transition = 'margin-top 150ms';
76        navmenu.style.marginTop = '0px';
77        navmenu.classList.add('shadow-sm');
78        navmenu.classList.remove('animate__animated','animate__slideInUp');
79        navmenu.classList.add('animate__animated','animate__slideInDown');
80    }else{
81        navmenu.style.transition = 'margin-top 150ms';
82        navmenu.style.marginTop = '45px';
83        navmenu.classList.remove('shadow-sm');
84        navmenu.classList.remove('animate__animated','animate__slideInDown');
85        navmenu.classList.add('animate__animated','animate__slideInUp');
86    }
87}
88function HideShowSocial(mostrar){
89    const navsocial = document.getElementById('navsocial');
90    if(mostrar){
91        navsocial.classList.remove('animate__animated','animate__fadeOut');
92        navsocial.classList.add('animate__animated','animate__fadeIn');
93        navsocial.style.display = 'block';
94    }else{
95        navsocial.classList.remove('animate__animated','animate__fadeIn');
96        navsocial.classList.add('animate__animated','animate__fadeOut');
97        navsocial.style.display = 'none';
98    }
99}
100function HideShowTop(mostrar){
101    const goTopBtn = document.getElementById('goTopBtn');
102    if(mostrar){
103        goTopBtn.classList.add('animate__animated', 'animate__bounceIn');
104        goTopBtn.style.display = 'block';
105    }else{
106        goTopBtn.classList.remove('animate__animated', 'animate__bounceIn');
107        goTopBtn.style.display = 'none';
108    }
109}
110function goToTop() { window.scrollTo({top:0,behavior:"smooth"});}
111function expandInput(input) {
112    input.style.width = '100%';
113    document.querySelectorAll('.srcmenuhiden').forEach(element => {
114        element.classList.add('d-none');
115    });
116}
117
118function shrinkInput(input) {
119    if (input.value.trim() === '') {
120        input.style.width = '10%';
121        document.querySelectorAll('.srcmenuhiden').forEach(element => {
122            element.classList.remove('d-none');
123        });
124    }
125}
126function cargaMapas() {
127    // Verificar si se aceptaron cookies analíticas
128    const analiticas = getCookie('cookie_analiticas');
129
130    if (analiticas !== '1') {
131        // Mostrar mensaje en cada contenedor de mapa si no existe ya
132        if (mapasifrm === 0) {
133            const mapas = ['frmmatriz1', 'frmmatriz2', 'frmmatriz3', 'frmmatriz4'];
134
135            mapas.forEach(mapaId => {
136                const contenedor = document.getElementById(mapaId);
137                if (contenedor) {
138                    contenedor.innerHTML = `
139                        <div onclick="$('#cookiesModal').modal('show');" style="background-color: #f8f9fa; border: 2px dashed #dee2e6; border-radius: 8px; padding: 30px; text-align: center; height: 210px; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; transition: all 0.3s ease;">
140                            <i class="fas fa-map-marked-alt" style="font-size: 40px; color: #6c757d; margin-bottom: 15px;"></i>
141                            <p style="margin: 0; color: #495057; font-size: 14px;">Para visualizar el mapa debe aceptar las cookies analíticas</p>
142                            <small style="margin-top: 10px; color: #6c757d; font-size: 12px;">Haga clic aquí para configurar</small>
143                        </div>
144                    `;
145                }
146            });
147            mapasifrm = -1; // Marcar como bloqueado
148        }
149        return;
150    }
151
152    if (mapasifrm === 0 || mapasifrm === -1) {
153        $("#frmmatriz1 img").addClass('d-none');
154        const mapas = [
155            {
156                id: 'frmmatriz1',
157                src: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d862.7025986899649!2d-79.88108030776698!3d-2.1906066861081954!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x14a1fa5073d9b961!2sITB!5e0!3m2!1ses!2sec!4v1531433130147'
158            },
159            {
160                id: 'frmmatriz2',
161                src: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d249.1847166982773!2d-79.87885667242135!3d-2.1706338907741345!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x902d6dca6eea2d8f%3A0x82a201f05538ef6e!2sInstituto+Tecnol%C3%B3gico+Bolivariano+campus+Atarazana!5e0!3m2!1ses!2sec!4v1531432912369'
162            },
163            {
164                id: 'frmmatriz3',
165                src: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3986.954378772085!2d-79.88101505839276!3d-2.171046517043672!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x902d6dca6eea2d8f%3A0x82a201f05538ef6e!2sInstituto+Tecnol%C3%B3gico+Bolivariano+campus+Atarazana!5e0!3m2!1ses!2sec!4v1531432602618'
166            },
167            {
168                id: 'frmmatriz4',
169                src: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1237.7931418024139!2d-79.88039841507808!3d-2.188827214631422!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0xd5c8cb92f59d25ce!2sCAMPUS+ROCAFUERTE!5e0!3m2!1ses!2sec!4v1531432798406'
170            }
171        ];
172
173        mapas.forEach(mapa => {
174            const contenedor = document.getElementById(mapa.id);
175            // Limpiar el contenedor antes de agregar el iframe
176            contenedor.innerHTML = '';
177
178            const ifrm = document.createElement('iframe');
179            ifrm.className = 'gmap_iframe';
180            ifrm.width = '100%';
181            ifrm.height = '210';
182            ifrm.frameBorder = '0';
183            ifrm.scrolling = 'no';
184            ifrm.marginHeight = '0';
185            ifrm.marginWidth = '0';
186            ifrm.src = mapa.src;
187            contenedor.appendChild(ifrm);
188        });
189        mapasifrm = 1;
190    }
191}
192document.querySelectorAll('#navbarCollapseMenu .no-close').forEach(item => {
193    item.addEventListener('click', function (e) {
194        e.stopPropagation();
195    });
196});
197function soloNumero(evt,id){
198    // console.log(document.getElementById(id).checked);
199    if(!document.getElementById(id).checked){
200        const code = evt.which || evt.keyCode;
201        if(code === 8 || code === 9 || code === 13 || code === 27 ||
202            (code >= 35 && code <= 40) ||
203            (code >= 112 && code <= 123)) {
204            return true;
205        }
206        return (code >= 48 && code <= 57);
207    }else{
208        return true;
209    }
210
211}
212function Cedula(ced){
213    var res = true;
214    var msj='';
215    var cedula = ced;
216    if(cedula.length < 1){
217        msj = 'La cedula debe tener 10 digitos';
218    }
219    if(cedula.length > 0 && cedula.length < 10){
220        msj = 'La cedula debe tener 10 digitos';
221    }else{
222        array = cedula.split("");
223        num = array.length;
224        if ( num == 10 )
225        {
226            total = 0;
227            digito = (array[9]*1);
228            for( i=0; i < (num-1); i++ )
229            {
230                mult = 0;
231                if ( ( i%2 ) != 0 ) {
232                    total = total + ( array[i] * 1 );
233                }
234                else
235                {
236                    mult = array[i] * 2;
237                    if ( mult > 9 )
238                        total = total + ( mult - 9 );
239                    else
240                        total = total + mult;
241                }
242            }
243            decena = total / 10;
244            decena = Math.floor( decena );
245            decena = ( decena + 1 ) * 10;
246            final = ( decena - total );
247            if ( ( final == 10 && digito == 0 ) || ( final == digito ) ) {
248                res = true;
249                msj = '';
250            }
251            else
252            {
253                msj = 'Cedula invalida';
254                res = false;
255            }
256        }
257        if(cedula == '0000000000' || cedula == '1212121212' || cedula == '1111111111'){
258            res=false;
259            msj = 'Cedula invalida';
260        }
261    }
262    return msj;
263}
264
265function setCookie(key, value, expiry) {
266    var expires = new Date();
267    expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000));
268    document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + ';path=/';
269}
270function getCookie(key) {
271    var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
272    return keyValue ? keyValue[2] : null;
273}
274function eraseCookie(key) {
275    setCookie(key, '', -1);
276}

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.