PageSourceSearch

https://www.ual.es/application/themes/ual/js/ualbot-launcher.js

js ual.es collected 2026-10-01 08:49:05 UTC 5,485 bytes, 146 lines download raw bytes

1(function () {
2    'use strict';
3
4    var translations = {
5        es: {
6            closeAria: 'Cerrar y ocultar asistente de chat',
7            bubbleText: '\u00BFEn qu\u00E9 puedo ayudarte?',
8            linkAria: 'Chatear con UALBot Acad\u00E9mico - Abre en una nueva pesta\u00F1a',
9            imgAlt: 'UALBot Acad\u00E9mico'
10        },
11        en: {
12            closeAria: 'Close and hide chat assistant',
13            bubbleText: 'How can I help you?',
14            linkAria: 'Chat with UALBot Academic - Opens in a new tab',
15            imgAlt: 'UALBot Academic'
16        }
17    };
18
19    function init() {
20        var allowedUrls = [
21            '/estudios/gestionesacademicas/secretaria',
22            '/estudios/gestionesacademicas/becas',
23            '/estudios/gestionesacademicas/acceso',
24            '/automatricula'
25        ];
26        var currentUrl = window.location.href;
27        var matches = allowedUrls.some(function (url) {
28            return currentUrl.indexOf(url) !== -1;
29        });
30        if (!matches) {
31            return;
32        }
33
34        var htmlLang = document.documentElement.lang
35            ? document.documentElement.lang.substring(0, 2).toLowerCase()
36            : 'es';
37        var lang = (htmlLang === 'en') ? 'en' : 'es';
38        var t = translations[lang];
39
40        var container = document.createElement('div');
41        container.style.position = 'fixed';
42        container.style.bottom = '20px';
43        container.style.right = '20px';
44        container.style.zIndex = '999999';
45
46        var closeBtn = document.createElement('button');
47        closeBtn.setAttribute('aria-label', t.closeAria);
48        closeBtn.style.position = 'absolute';
49        closeBtn.style.top = '-4px';
50        closeBtn.style.right = '-4px';
51        closeBtn.style.width = '24px';
52        closeBtn.style.height = '24px';
53        closeBtn.style.borderRadius = '50%';
54        closeBtn.style.backgroundColor = '#336195';
55        closeBtn.style.color = '#ffffff';
56        closeBtn.style.border = '2px solid #ffffff';
57        closeBtn.style.fontSize = '14px';
58        closeBtn.style.lineHeight = '1';
59        closeBtn.style.cursor = 'pointer';
60        closeBtn.style.padding = '0';
61        closeBtn.style.display = 'flex';
62        closeBtn.style.alignItems = 'center';
63        closeBtn.style.justifyContent = 'center';
64        closeBtn.style.zIndex = '2';
65        closeBtn.style.boxShadow = '0 2px 6px rgba(0,0,0,0.25)';
66        closeBtn.textContent = '\u00D7';
67        closeBtn.addEventListener('click', function () {
68            container.style.display = 'none';
69        });
70
71        var bubble = document.createElement('div');
72        bubble.setAttribute('aria-live', 'polite');
73        bubble.textContent = t.bubbleText;
74        bubble.style.position = 'absolute';
75        bubble.style.right = '96px';
76        bubble.style.top = '50%';
77        bubble.style.transform = 'translateY(-50%)';
78        bubble.style.backgroundColor = '#ffffff';
79        bubble.style.color = '#1a1a1a';
80        bubble.style.padding = '10px 18px';
81        bubble.style.borderRadius = '20px 20px 0px 20px';
82        bubble.style.boxShadow = '0 4px 16px rgba(0,0,0,0.25)';
83        bubble.style.fontSize = '14px';
84        bubble.style.fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
85        bubble.style.whiteSpace = 'nowrap';
86        bubble.style.transition = 'opacity 0.5s ease';
87        bubble.style.opacity = '1';
88        bubble.style.zIndex = '1';
89        bubble.style.pointerEvents = 'none';
90
91        setTimeout(function () {
92            bubble.style.opacity = '0';
93            setTimeout(function () {
94                bubble.style.display = 'none';
95            }, 500);
96        }, 10000);
97
98        var link = document.createElement('a');
99        link.href = 'https://acabot.ia.ual.es/';
100        link.target = '_blank';
101        link.rel = 'noopener noreferrer';
102        link.setAttribute('aria-label', t.linkAria);
103        link.style.display = 'block';
104        link.style.transition = 'transform 0.2s ease';
105        link.style.borderRadius = '50%';
106        link.style.boxShadow = '0 4px 16px rgba(0,0,0,0.25)';
107        link.addEventListener('mouseenter', function () {
108            link.style.transform = 'scale(1.1)';
109        });
110        link.addEventListener('mouseleave', function () {
111            link.style.transform = 'scale(1)';
112        });
113        link.addEventListener('focus', function () {
114            link.style.transform = 'scale(1.1)';
115        });
116        link.addEventListener('blur', function () {
117            link.style.transform = 'scale(1)';
118        });
119
120        var img = document.createElement('img');
121        img.src = 'https://acabot.ia.ual.es/avatars/UALBot';
122        img.alt = t.imgAlt;
123        img.className = 'rounded-circle ual-logo';
124        img.style.display = 'block';
125        img.style.width = '79px';
126        img.style.height = '79px';
127        img.style.borderRadius = '50%';
128        img.style.border = '3px solid #336195';
129        img.onerror = function () {
130            this.onerror = null;
131            this.src = 'https://placehold.co/96x96/FFFFFF/336195?text=UAL';
132        };
133
134        link.appendChild(img);
135        container.appendChild(bubble);
136        container.appendChild(closeBtn);
137        container.appendChild(link);
138        document.body.appendChild(container);
139    }
140
141    if (document.readyState === 'loading') {
142        document.addEventListener('DOMContentLoaded', init);
143    } else {
144        init();
145    }
146})();

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.