PageSourceSearch

https://www.igai.pt/Style%20Library/portal/js/scripts.js

js igai.pt collected 2026-10-02 04:42:41 UTC 8,442 bytes, 241 lines download raw bytes

1 /*
2-----------------------------------------------------------------------------
3    Accordion
4-----------------------------------------------------------------------------
5*/
6function accordionToogle(obj) {
7    obj.classList.toggle("active");
8    var panel = obj.nextElementSibling;
9    if (panel.style.display === "block") {
10        panel.style.display = "none";
11    } else {
12        panel.style.display = "block";
13    }
14}
15
16 /*
17-----------------------------------------------------------------------------
18    Left Nav
19-----------------------------------------------------------------------------
20*/
21$(document).ready(function() {
22    $("div.nav > ul > li.dropdown > a").addClass("active");
23    $("div.nav > ul > li.dropdown > ul").css("display", "block");
24});
25/*
26-----------------------------------------------------------------------------
27  CLOSE ALERTA
28-----------------------------------------------------------------------------
29*/
30
31function CloseAlert() {
32    /* ALERTAS */
33    $("#alerta").closest(".alert").slideUp();
34    //return false;
35}
36
37/*
38-----------------------------------------------------------------------------
39  PESQUISA
40-----------------------------------------------------------------------------
41*/
42function openSearch() {
43    $('#searchArea').show();
44    $('#searchText').focus();
45}
46function closeSearch() {
47    $('#searchArea').hide();
48}
49
50/*
51-----------------------------------------------------------------------------
52  MODEL
53-----------------------------------------------------------------------------
54*/
55function closeModal(id) {
56    $('#openModal'+id).hide();
57}
58
59function openModal(id) {
60    $('#openModal'+id).show();
61}
62
63 /*
64-----------------------------------------------------------------------------
65    Slider OWL
66-----------------------------------------------------------------------------
67*/
68$(document).ready(function() {
69    $("#owl-slider").owlCarousel({
70        navigation : true,
71        items : 1, 
72        loop:true,
73        nav:true,
74        navText:['',''],
75        dots:false,
76        animateOut: 'fadeOut',
77        animateIn: 'fadeIn',
78    });
79
80    $("#owl-slider-destaques").owlCarousel({
81        navigation : true,
82        items : 1, 
83        autoplay:true,
84        autoplayTimeout:10000,
85        loop:true,
86        nav:true,
87        navText:['',''],
88        dots:true
89    });
90});
91
92
93 /*
94-----------------------------------------------------------------------------
95    NEWS
96-----------------------------------------------------------------------------
97*/
98$(document).ready(function () {
99
100    var url, title, description;
101
102    const meta_url = document.querySelector("meta[property='og:url']");
103    const meta_title = document.querySelector("meta[property='og:title']");
104    const meta_description = document.querySelector("meta[property='og:description']");
105    
106    if (meta_url !== null) url = meta_url.getAttribute("content");
107    if (meta_title !== null) title = meta_title.getAttribute("content");
108    if (meta_description !== null) description = meta_description.getAttribute("content");
109    if (title !== undefined) document.title = title;
110
111    const fb = document.querySelector('#button-f');
112    if (fb !== null) {
113        fb.href = `https://www.facebook.com/sharer/sharer.php?u=${url}`;
114        fb.target = '_blank';
115    }
116
117    const twitter = document.querySelector('#button-t');
118    if (twitter !== null) {
119        twitter.href = `https://twitter.com/intent/tweet?&url=${url}&text=${title}`;
120        twitter.target = '_blank';
121    }
122
123    const whatsapp = document.querySelector('#button-w');
124    if (whatsapp !== null) {
125        whatsapp.href = `whatsapp://send?text=${url}`;
126        whatsapp.target = '_blank';
127    }
128
129    const mail = document.querySelector('#button-m');
130    if (whatsapp !== null) {
131        mail.href = `mailto:?subject=Portal da IGAI - ${title}&body=${title}%0A%0A${description}%0A%0A${decodeURI(url)}%0A%0A`;
132    }
133    
134});
135
136function copyLink() {
137    if (window.location.protocol !== 'https:') {
138        window.location.href.replace("http", "https");
139    }
140    navigator.clipboard.writeText(decodeURI(window.location.href));
141
142    const copy = document.querySelector('#button-c');
143    copy.innerHTML = "<i class='fas fa-link'><!----></i>Copiado";
144    setTimeout(function () {
145        copy.innerHTML = "<i class='fas fa-link'><!----></i>Copiar ligação";
146    }, 2000);
147}
148
149function showDropdown() {
150    $('#dropdown-links').addClass("show");
151}
152
153// Close the dropdown menu if the user clicks outside of it
154window.onclick = function (event) {
155    if (!event.target.matches('#share') && !event.target.matches('#button-c')) {
156        var dropdowns = document.getElementsByClassName("dropdown-content");
157        var i;
158        for (i = 0; i < dropdowns.length; i++) {
159            var openDropdown = dropdowns[i];
160            if (openDropdown.classList.contains('show')) {
161                openDropdown.classList.remove('show');
162            }
163        }
164    }
165}
166
167
168/*
169-----------------------------------------------------------------------------
170  COOKIE CONSENT
171-----------------------------------------------------------------------------
172*/
173var language = 'pt';
174var pathname = new URL(window.location.href).pathname;
175pathname.split("/").forEach(lang)
176
177function lang(item, index, arr) {
178  if(arr[index] = item == 'en'){
179    language = 'en';
180  }
181}
182
183var purecookieTitle = "Cookies";
184var purecookieDesc = language == 'pt' ? "Este site utiliza cookies para proporcionar uma melhor experiência de utilização. Para continuar a navegar no site deve aceitar a " : "This website uses co
184okies to provide a better user experience. To continue browsing the site, you must accept the ";
185var purecookieLink = language == 'pt' ? '<a href="/pt//PoliticaPrivacidade/" title="Ir para a página de Política de Privacidade">Política de Privacidade</a>': '<a href="/en/PrivacyPolicy/" title="Go to Privacy Policy page">Privacy Policy</a>';
186var purecookieButton = language == 'pt' ? "Aceito" : "Accept";
187
188function pureFadeIn(e, o) {
189    var i = document.getElementById(e);
190    i.style.opacity = 0, i.style.display = o || "block",
191        function e() {
192            var o = parseFloat(i.style.opacity);
193            (o += .02) > 1 || (i.style.opacity = o, requestAnimationFrame(e))
194        }()
195}
196
197function pureFadeOut(e) {
198    var o = document.getElementById(e);
199    o.style.opacity = 1,
200        function e() {
201            (o.style.opacity -= .02) < 0 ? o.style.display = "none" : requestAnimationFrame(e)
202        }()
203}
204
205function setCookie(e, o, i) {
206    var t = "";
207    if (i) {
208        var n = new Date;
209        n.setTime(n.getTime() + 24 * i * 60 * 60 * 1e3), t = "; expires=" + n.toUTCString()
210    }
211    document.cookie = e + "=" + (o || "") + t + "; path=/"
212}
213
214function getCookie(e) {
215    for (var o = e + "=", i = document.cookie.split(";"), t = 0; t < i.length; t++) {
216        for (var n = i[t];
217            " " == n.charAt(0);) n = n.substring(1, n.length);
218        if (0 == n.indexOf(o)) return n.substring(o.length, n.length)
219    }
220    return null
221}
222
223function eraseCookie(e) {
224    document.cookie = e + "=; Max-Age=-99999999;"
225}
226
227function cookieConsent() {
228    //getCookie("purecookieDismiss") || (document.body.innerHTML += '<div class="cookieConsentContainer" id="cookieConsentContainer"><div class="cookieTitle"><a>' + purecookieTitle + '</a></div><div class="cookieDesc"><p>' + purecookieDesc + " " + purecookieLink + '</p></div><div class="cookieButton"><a onClick="purecookieDismiss();">' + purecookieButton + "</a></div></div>", pureFadeIn("cookieConsentContainer"))
229    if (getCookie("purecookieDismiss") == null) {
230        $("body").append('<div class="cookieConsentContainer" id="cookieConsentContainer"><div class="cookieTitle"><div>' + purecookieTitle + '</div></div><div class="cookieDesc"><p>' + purecookieDesc + ' ' + purecookieLink + '</p></div><div class="cookieButton"><a href="javascript:void(0)" role="button" onClick="purecookieDismiss();">' + purecookieButton + '</a></div></div>');
231        pureFadeIn("cookieConsentContainer");
232    }
233}
234
235function purecookieDismiss() {
236    setCookie("purecookieDismiss", "1", 7), pureFadeOut("cookieConsentContainer")
237}
238
239$(document).ready(function () {
240    cookieConsent();
241});

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.