PageSourceSearch

https://ufsc.br/wp-content/themes/brasilGov/js/functions.js?ver=4.7.37

js ufsc.br collected 2026-09-24 07:51:04 UTC 7,039 bytes, 246 lines download raw bytes

1function setActiveStyleSheet(title) {
2  var i, a, main;
3  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
4    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
5      a.disabled = true;
6      if(a.getAttribute("title") == title) a.disabled = false;
7    }
8  }
9}
10
11function getActiveStyleSheet() {
12  var i, a;
13  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
14    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
15  }
16  return null;
17}
18
19function getPreferredStyleSheet() {
20  var i, a;
21  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
22    if(a.getAttribute("rel").indexOf("style") != -1
23       && a.getAttribute("rel").indexOf("alt") == -1
24       && a.getAttribute("title")
25       ) return a.getAttribute("title");
26  }
27  return null;
28}
29
30function createCookie(name,value,days) {
31  if (days) {
32    var date = new Date();
33    date.setTime(date.getTime()+(days*24*60*60*1000));
34    var expires = "; expires="+date.toGMTString();
35  }
36  else expires = "";
37  document.cookie = name+"="+value+expires+"; path=/";
38}
39
40function readCookie(name) {
41  var nameEQ = name + "=";
42  var ca = document.cookie.split(';');
43  for(var i=0;i < ca.length;i++) {
44    var c = ca[i];
45    while (c.charAt(0)==' ') c = c.substring(1,c.length);
46    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
47  }
48  return null;
49}
50
51window.onload = function(e) {
52  var cookie = readCookie("style");
53  var title = cookie ? cookie : getPreferredStyleSheet();
54  setActiveStyleSheet(title);
55}
56
57window.onunload = function(e) {
58  var title = getActiveStyleSheet();
59  createCookie("style", title, 365);
60}
61
62var cookie = readCookie("style");
63var title = cookie ? cookie : getPreferredStyleSheet();
64setActiveStyleSheet(title);
65
66
67
68jQuery(document).ready(function (){
69
70	//if(!Modernizr.input.placeholder){
71		jQuery('[placeholder]').focus(function() {
72		  var input = jQuery(this);
73		  if (input.val() == input.attr('placeholder')) {
74			input.val('');
75			input.removeClass('placeholder');
76		  }
77		}).blur(function() {
78		  var input = jQuery(this);
79		  if (input.val() == '' || input.val() == input.attr('placeholder')) {
80			input.addClass('placeholder');
81			input.val(input.attr('placeholder'));
82		  }
83		}).blur();
84		jQuery('[placeholder]').parents('form').submit(function() {
85		  jQuery(this).find('[placeholder]').each(function() {
86			var input = jQuery(this);
87			if (input.val() == input.attr('placeholder')) {
88			  input.val('');
89			}
90		  })
91		});
92	//}
93
94	jQuery.fn.extend({
95		scrollTo : function(speed, easing) {
96			return this.each(function() {
97				var targetOffset = jQuery(this).offset().top;
98				jQuery('html,body').animate({ scrollTop: targetOffset }, speed, easing);
99			});
100		}
101	});
102
103	jQuery('a[href*=#]:not([href=#])').click(function() {
104    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) {
105
106      var target = jQuery(this.hash);
107      target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
108         if (target.length) {
109           jQuery('html,body').animate({
110               scrollTop: target.offset().top
111          }, 1000);
112          return false;
113      }
114    }
115	});
116
117	jQuery.fn.accessibleDropDown = function() {
118	  var el = jQuery(this);
119
120	  jQuery("li", el).mouseover(function() {
121	    jQuery(this).addClass("hover");
122	  }).mouseout(function() {
123	    jQuery(this).removeClass("hover");
124	  });
125
126	  jQuery("a", el).focus(function() {
127	    jQuery(this).parents("li").addClass("hover");
128	  }).blur(function() {
129	    jQuery(this).parents("li").removeClass("hover");
130	  });
131	}
132
133	jQuery("#nav").accessibleDropDown();
134	column1 = jQuery(".page-128 .children li:lt(15)");
135	column2 = jQuery(".page-128 .children li:gt(14)");
136	jQuery(".page-128 .children").append('<div class="column" id="column1"></div>');
137	jQuery(".page-128 .children").append('<div class="column" id="column2"></div>');
138	column1.appendTo(jQuery('#column1'));
139	column2.appendTo(jQuery('#column2'));
140
141
142	// news
143	jQuery("#tagcloud").each(function() {
144	  jQuery.data(this, "realHeight", jQuery(this).height());
145	}).css({ overflow: "hidden", height: "160px" });
146
147	jQuery('#more_tagcloud, #more_tagcloud_before').click(function() {
148		if (jQuery('#tagcloud').height() == jQuery('#tagcloud').data("realHeight")) {
149			jQuery('#tagcloud').animate({ height: '160px' }, 600).css("margin-bottom", 0);
150			jQuery('#more_tagcloud_before').show();
151			jQuery('#more_tagcloud span').text('Mais');
152			jQuery('header').scrollTo('slow','swing');
153		} else {
154			jQuery('#tagcloud').animate({ height: jQuery('#tagcloud').data("realHeight") }, 600).css("margin-bottom", 5);
155			jQuery('#more_tagcloud span').text('Menos');
156			jQuery('#more_tagcloud_before').hide();
157			jQuery('.tag').scrollTo('slow','swing');
158		}
159	});
160
161
162	var allPanels = jQuery('.accordion > dd').hide();
163	jQuery('.accordion > dt > a').click(function() {
164		allPanels.slideUp();
165		jQuery(this).parent().next().slideDown();
166		if (jQuery(this).attr('class') === "radio" && jQuery('#radio_holder').html() === "") {
167			jQuery('#radio_mobile').remove();
168			var radio = '<iframe src="https://webcast.overseebrasil.com.br/player_audio.php?af=1195383292&ls=289&i=1&l=100%&a=25&ovp=1176&ksp=false"></iframe>';
169			jQuery('#radio_holder').html(radio);
170		}
171	});
172
173	// schedule
174	jQuery('h2.setor').click(function() {
175		jQuery(this).next('div.agenda').slideToggle();
176		jQuery(this).scrollTo('slow','swing');
177	});
178
179
180	// breadcrumbs' improvement
181	if (jQuery("#breadcrumbs").length > 0) {
182
183		var totalWidth = 0;
184		jQuery("#breadcrumbs li:not(:last)").each(function(index) {
185		    totalWidth += parseInt(jQuery(this).width(), 10);
186		});
187		avaliable = jQuery("#breadcrumbs").width() - totalWidth - 3;
188
189		jQuery("#breadcrumbs li:last").css({ 'width': avaliable, 'overflow' : 'hidden', 'white-space' : 'nowrap' });
190
191	}
192
193	jQuery('.icon-print').click(function() {
194		window.print();
195		return false;
196	});
197
198
199	jQuery('#send').click(function(e){
200
201		jQuery('#respond input[type=text], #respond textarea').each(function(){
202
203			error = false;
204
205			if (jQuery(this).hasClass('required')) {
206				if (jQuery(this).val() == "") {
207					alert("Verifique o campo: " + jQuery(this).attr('placeholder'));
208					jQuery(this).focus();
209					error = true;
210					return false;
211				}
212			}
213
214			if (jQuery(this).attr('id') == 'email') {
215				var re = /\S+@\S+\.\S+/;
216				if(!re.test(jQuery(this).val())) {
217					alert("O email informado é inválido.");
218					error = true;
219					return false;
220				}
221			}
222
223			// if (jQuery(this).attr('id') == 'challenge') {
224			// 	if(jQuery(this).val() != jQuery('#challenge_hash').val()) {
225			// 		alert("O valor da soma está incorreto.");
226			// 		error = true;
227			// 		return false;
228			// 	}
229			// }
230		});
231
232		if (error != true) jQuery('#commentform').submit();
233
234	});
235
236
237	jQuery("#contrast").click(function() {		
238		if (getActiveStyleSheet() == "high") {
239			setActiveStyleSheet('default');
240		} else {
241			setActiveStyleSheet('high');
242		}
243
244	});
245
246});

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.