PageSourceSearch

https://portalmunicipe.mun-aljustrel.pt/includes/scripts/impruv.functions.js?v=2-0

js mun-aljustrel.pt collected 2026-10-02 07:55:48 UTC 14,443 bytes, 443 lines download raw bytes

1/*********************  ACCORDION  *************************************/
2(function ($) {
3    $.fn.extend({
4        accordion: function () {
5            return this.each(function () {
6                if ($(this).data('accordiated'))
7                    return false;
8                $.each($(this).find('ul, li>div'), function () {
9                    $(this).data('accordiated', true);
10                    $(this).hide();
11                });
12                $.each($(this).find('a:not(.foo)'), function () {
13                    $(this).click(function (e) {
14                        activate(e.target);
15                        return void (0);
16                    });
17                });
18
19                var active = false;
20                if (location.hash)
21                    active = $(this).find('a[href=' + location.hash + ']')[0];
22                else if ($(this).find('li.current'))
23                    active = $(this).find('li.current a')[0];
24
25                if (active) {
26                    activate(active, 'toggle', 'parents');
27                    $(active).parents().show();
28                }
29
30                function activate(el, effect, parents) {
31                    $(el)[(parents || 'parent')]('li').toggleClass('active').siblings().removeClass('active').children('ul, div').slideUp('fast');
32                    $(el).siblings('ul, div')[(effect || 'slideToggle')]((!effect) ? 'fast' : null);
33                }
34
35            });
36        }
37    });
38})(jQuery);
39
40/**/
41
42// JavaScript Document
43/* Clear Forms ----------------- */
44
45function _clear(t) {
46    if (t._Temp == "" || t._Temp == null || t._Temp == undefined)
47        t._Temp = t.value;
48    if (t.value == t._Temp)
49        t.value = "";
50    removeClass(t, "Form_error");
51}
52function _check(t) {
53    if (t.value == "" || t.value == null && t.value != t._Temp)
54        t.value = t._Temp;
55}
56
57function hasClass(ele, cls) {
58    return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
59}
60function removeClass(ele, cls) {
61    if (hasClass(ele, cls)) {
62        var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
63        ele.className = ele.className.replace(reg, ' ');
64    }
65}
66
67function isEmail(email) {
68    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
69    if (reg.test(email) == false) {
70        return false;
71    }
72    else
73        return true;
74}
75function passOver(elem) {
76    elem.style.background = "none #FFF";
77}
78function passOut(elem) {
79    if (elem.value == "" || elem.value == undefined)
80        elem.style.background = "url(/images/gif/password.gif) 5px center no-repeat  #FFF";
81}
82function PrintElementID(id, pg) {
83    var oPrint, oJan;
84    oPrint = window.document.getElementById(id).innerHTML;
85    oJan = window.open(pg);
86    oJan.document.write(oPrint);
87    oJan.history.go();
88    oJan.window.print();
89}
90
91function isBlank(val) { if (val == null) { return true; } for (var i = 0; i < val.length; i++) { if ((val.charAt(i) != ' ') && (val.charAt(i) != "\t") && (val.charAt(i) != "\n") && (val.charAt(i) != "\r")) { return false; } } return true; }
92function isNumeric(val) { return (parseFloat(val, 10) == (val * 1)); }
93/*
94function validaNif(nif) {
95
96    // var nif = value;
97
98    if ((!isBlank(nif)) && (isNumeric(nif)) && (nif.length == 9) && (nif.substr(0, 1) == 1 || nif.substr(0, 1) == 2 || nif.substr(0, 1) == 5 || nif.substr(0, 1) == 6 || nif.substr(0, 1) == 8 || nif.substr(0, 1) == 9)) {
99        var dC = parseInt(nif.substr(0, 1)) * 9;
100        for (var i = 2; i <= 8; i++) {
101            dC += (nif.substr(i - 1, 1)) * (10 - i);
102        }
103
104        dC = 11 - (dC % 11);
105
106        dC = (dC >= 10) ? 0 : dC;
107
108        if (dC != nif.substr(8, 1)) {
109            //args.IsValid = false;
110            return false;
111
112        }
113        else {
114            return true;
115        }
116    }
117    else {
118        return false;
119
120    }
121}
122*/
123function validaNif(value) {
124    const nif = typeof value === 'string' ? value : value.toString();
125    const validationSets = {
126        one: ['1', '2', '3', '5', '6', '8'],
127        two: ['45', '70', '71', '72', '74', '75', '77', '79', '90', '91', '98', '99']
128    };
129
130    if (nif.length !== 9) {
131        return false;
132    }
133
134    if (!validationSets.one.includes(nif.substr(0, 1)) && !validationSets.two.includes(nif.substr(0, 2))) {
135        return false;
136    }
137
138    const total = nif[0] * 9 + nif[1] * 8 + nif[2] * 7 + nif[3] * 6 + nif[4] * 5 + nif[5] * 4 + nif[6] * 3 + nif[7] * 2;
139    const modulo11 = (Number(total) % 11);
140
141    const checkDigit = modulo11 < 2 ? 0 : 11 - modulo11;
142
143    return checkDigit === Number(nif[8]);
144}
145
146
147
148
149/*///<summary>This function calls the GetPriorityCodes Web Service method.</summary>
150///<param name="error">Succeed Object</param>
151///<param name="error">Error Object</param>
152function getData(controlLocation, divId) {
153loadControl.GetControlHtml(controlLocation, SucceededCallback, onFailedWS);
154
155///<summary>Method for Web Service Failed Event</summary>
156///<param name="error">Error Object</param>
157///<returns>false</returns>
158function onFailedWS(error) {
159alert(error.get_message());
160}
161///<summary>This is the callback function that processes the Web Service return value.</summary>
162///<param name="result">result Object from Web Service</param>
163function SucceededCallback(result) {
164//get the div element
165var RsltElem = $get(divId);
166//update div inner Html
167RsltElem.innerHTML = result;
168}
169
170}
171*/
172function getData(controlLocation, divId) {
173   // var controlLocation = 'components/gerais/expor_opniao.ascx';
174    $.ajax({
175        url: '/components/util/Ajax.svc/renderuc?path=' + controlLocation,
176        dataType: 'html',
177        success: function(data) {
178            $(divId).html(data);
179        }
180    });
181}
182
183/*$(document).ready(function(){
184	$('#mainMenu ul.main').css('display','block');
185});
186
187*/
188/* Font-size */
189$(document).ready(function(){
190	$(".zoomtext a").click(function(){
191		var $speech = $('.tituloConteudos, #mainContent');
192		var currentSize = $speech.css('font-size');
193		var num = parseFloat(currentSize,11);
194		var unit = currentSize.slice(-2);
195		if(this.id == 'plus' && num <= 16){ num += 1; }
196		else if(this.id == 'minus' && num >= 10) { num -= 1; }
197		$speech.css('font-size', num + unit);
198		$speech.css('line-height', (num+6) + unit);
199		return false;
200	 });
201});
202
203
204
205/* Adicionar aos Favoritos */
206eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(7($){$.8.9=7(d){g e=$.v({},$.8.9.k,d);g f=e.l;2.w(7(){5(!$(2).3(\'4\')||$(2).3(\'4\')=="#"){$(2).3(\'4\',j.x.4)}5(!$(2).3(\'6\')){$(2).3(\'6\',y.6)}5($.h.z){$(2).3(\'m\',$(2).3(\'4\')).3(\'4\',\'\').3(\'4\',\'A:B(0)\').3(\'C\',\'$.8.9.n(2,"\'+$(2).3(\'6\')+\'","\'+$(2).3(\'m\')+\'")\')}i{$(2).o(p)}});7 p(a){g b=$(2).3(\'4\');g c=$(2).3(\'6\');b=b.E("q:///","F://q/");5($.h.G){j.H.I(b,c)}i 5($.h.J){j.r.K(c,b,\'\')}i 5(L.M.N().O(\'P\')>-1){s(f)}i 5($.h.Q){s(f)}a.R()};t 2};$.8.9.k={l:\'S "T + D" U "V + D" W X, u Y 2 Z u 10 11.\'};$.8.9.n=7(e,a,b){e.12="r";e.6=a;e.4="";e.4=b;e.o();t 13}})(14);', 62, 67, '||this|attr|href|if|title|function|fn|jFav|||||||var|browser|else|window|defaults|msg|link|OperaBookmark|click|addToFavorites|file|sidebar|alert|return|to|extend|each|location|document|opera|javascript|void|onClick||replace|http|msie|external|AddFavorite|mozilla|addPanel|navigator|userAgent|toLowerCase|indexOf|chrome|safari|preventDefault|Press|Ctrl|or|CMD|for|MAC|add|page|your|bookmarks|rel|false|$'.split('|'), 0, {}))
207$(document).ready(function() {
208	//$('#fav').jFav();
209});
210
211
212/* Data */
213$(document).ready(function(){
214	var meses = new Array(12);
215	meses[0] = "Janeiro";
216	meses[1] = "Fevereiro";
217	meses[2] = "Março";
218	meses[3] = "Abril";
219	meses[4] = "Maio";
220	meses[5] = "Junho";
221	meses[6] = "Julho";
222	meses[7] = "Agosto";
223	meses[8] = "Setembro";
224	meses[9] = "Outubro";
225	meses[10] = "Novembro";
226	meses[11] = "Dezembro";
227	var data = new Date();
228	var dia = data.getDate();
229	var mes = data.getMonth();
230	var ano = data.getFullYear();
231	var min = data.getMinutes();
232	var sec = data.getSeconds();
233	var hrs = data.getHours();
234	var min = data.getMinutes();
235	var sec = data.getSeconds();
236	var _data = dia + " de " + meses[mes] + " de " + ano;
237	var time;
238	$('li.date').prepend(_data);
239});
240
241
242
243/* detect ie */
244/*$(document).ready(function(){
245
246	var userAgent = navigator.userAgent.toLowerCase();
247	$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
248	var version = 0;
249
250	if($.browser.msie){
251		userAgent = $.browser.version;
252		userAgent = userAgent.substring(0,userAgent.indexOf('.'));
253		version = userAgent;
254		name = 'internet explorer';
255		if(version > 8){
256			$('.cufonTitle, .cufon').hover(function(){
257				$(this).toggleClass('menucolor');
258			});
259		}
260	}
261
262});
263*/
264
265
266$(document).ready(function(){
267	$('#mainMenu #nav ul li a').hover(function(){
268		$(this).parent('li').toggleClass('traco');
269	});
270
271	$('#tabs').show();
272/*	$('#mainHeader, .wrap_mainmenu').fadeIn(400);
273	$('#centro, #container, #mainfooter').fadeIn(1000);
274	$('#centro, #mainfooter').css('overflow-x','visible');*/
275});
276
277
278/* accordions */
279$(function () {
280//    $('#mod_myprofile .top h2').each(function () {
281//        $(this).click(function () {
282//            $(this).parent().next('.content').slideToggle();
283//            $(this).toggleClass('close');
284//        });
285//    });
286    $('#mod_myprofile .top h2').click(function () {
287        $(this).children('a').toggleClass('expanded');
288        if ($.browser.msie) {
289            $(this).parent().next('.content').toggle();
290                   } else {
291            $(this).parent().next('.content').animate({ width: 'auto', height: 'toggle', opacity: 'toggle' }, { duration: 300 });
292        }
293        return false;
294    });
295});
296
297
298/* opiniao */
299$(function () {
300    $('.submeter_opiniao .mostrar').click(function () {
301        if ($.browser.msie) {
302            $('.submeter_opiniao #mapa').toggle('slow', function () {
303                // map.Resize();
304            });
305        } else {
306            $('.submeter_opiniao #mapa').animate({ width: 'auto', height: 'toggle', opacity: 'toggle' }, { duration: 300 }, function () {
307                map.Resize();
308            });
309        }
310        //map.Resize();
311        return false;
312    });
313    $('.submeter_opiniao .top h2').click(function () {
314        $(this).children('a').toggleClass('expanded');
315        if ($.browser.msie) {
316            $(this).parent().next('.content').toggle();
317            $(this).parent().next('.content').children().find('.foto').toggle();
318        } else {
319            $(this).parent().next('.content').animate({ width: 'auto', height: 'toggle', opacity: 'toggle' }, { duration: 300 });
320            $(this).parent().next('.content').children().find('.foto').animate({ width: 'auto', height: 'toggle', opacity: 'toggle' }, { duration: 400 });
321        }
322        Cufon.refresh();
323        return false;
324    });
325});
326$(document).ready(function () {
327    $('.resposta').each(function (index) {
328        //alert(index + ': ' + $(this).text());
329        $(this).click(function () {
330
331            if ($.browser.msie) {
332                $(this).parent().next(".sender").toggle('slow', function () {
333                    // map.Resize();
334                });
335            } else {
336                $(this).parent().next(".sender").animate({ width: 'auto', height: 'toggle', opacity: 'toggle' }, { duration: 300 }, function () {
337                    // map.Resize();
338                    alert("mapa");
339                });
340            }
341            //map.Resize();
342            return false;
343        });
344    });
345});
346window.onbeforeunload = function () {
347    try {
348        console.log("2");
349    } catch (err) {
350
351    }
352}
353function onloading() {
354//    $body = $("body");
355    //    $body.addClass("loading");
356  try {
357    var body= document.getElementsByTagName("body")[0]
358    addClass(body, "loading");
359    console.log("1");
360    }
361    catch (err) {
362    }
363}
364$(document).ready(function () {
365    try {
366        var body = document.getElementsByTagName("body")[0]
367        removeClass(body, "loading");
368        console.log("3");
369    }
370    catch (err) {
371
372    }
373
374});
375
376function addClass(ele, cls) {
377    if (!hasClass(ele, cls)) ele.className += " " + cls;
378}
379
380function removeClass(ele, cls) {
381    if (hasClass(ele, cls)) {
382        var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
383        ele.className = ele.className.replace(reg, ' ');
384    }
385}
386
387/* input file skin */
388$(document).ready(function () {
389    try {
390        $("input.fileSoBotoa").filestyle({
391            image: "/images/png/escolher.png",
392            imageheight: 20,
393            imagewidth: 112,
394            width: 112
395
396        });
397
398
399        $("input.file145").filestyle({
400            image: "/images/png/procurar.png",
401            imageheight: 25,
402            imagewidth: 97,
403            width: 145
404
405        });
406        $("input.file420").filestyle({
407            image: "/images/jpg/inputfile.jpg",
408            imageheight: 23,
409            imagewidth: 87,
410            width: 420
411        });
412        $("input.file270").filestyle({
413            image: "/images/jpg/inputfile.jpg",
414            imageheight: 23,
415            imagewidth: 87,
416            width: 270
417        });
418        $("input.file560").filestyle({
419            image: "/images/png/btn_procurar_pink.png",
420            imageheight: 23,
421            imagewidth: 87,
422            width: 460
423        });
424    } catch (err) {
425    }
426    try {
427        var value = $("txtPassword").val()
428        if (value != undefined) {
429            $("txtPassword").css("background", "url(/images/gif/password.gif) 5px center no-repeat  #FFF");
430        }
431    }
432    catch (ex) { }
433});
434
435function confirmDelete() {
436    var agree = confirm("Tem a certeza que deseja eliminar este registo?");
437    if (agree) {
438        onloading();
439        return true;
440    }
441    else
442        return false;
443}

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.