PageSourceSearch

https://obmep.org.br/js/home.js

js obmep.org.br collected 2026-09-24 09:54:22 UTC 3,736 bytes, 184 lines download raw bytes

1jQuery(function()// HOME BANNER
2{
3	var bannerActivePage = 1;
4	var bannerTotalPage  = jQuery("#banner-body").attr("total-page");;
5	var bannerTimer;
6	
7	moveBanner(1);
8	setNexInterval(1);
9
10	jQuery("#banner-window").height( jQuery("#banner-body img").outerHeight() );
11	jQuery("#banner-body div").height( jQuery("#banner-body img").outerHeight() );
12
13	//jQuery("#banner-window").height( getBannerHeight() );
14	//jQuery("#banner-body div").height( getBannerHeight() );
15
16	jQuery("#banner-body div").click( function()
17	{
18		window.location = jQuery(this).attr("href");
19	} );
20
21	jQuery(window).resize(function()
22	{
23		moveBanner(bannerActivePage,true);
24
25		setNexInterval(bannerActivePage);
26
27		jQuery("#banner-window").height( getBannerHeight() );
28		jQuery("#banner-body div").height( getBannerHeight() );
29
30	})
31	
32	jQuery(".banner-page-cell").click(function()
33	{
34		moveBanner(jQuery(this).attr('page'));
35		
36		setNexInterval(jQuery(this).attr('page'));
37		
38	});
39	
40	jQuery("#banner-body").hover(
41	function()
42	{
43		bannerTimer.pause();
44	},
45	function()
46	{
47		bannerTimer.resume();
48	});
49	
50	function startInverval(time)
51	{
52		stopInterval();
53		
54		bannerTimer = new RecurringTimer(function()
55		{
56			bannerActivePage++;
57			if(bannerActivePage > bannerTotalPage)bannerActivePage=1;
58			
59			moveBanner(bannerActivePage);
60			setNexInterval(bannerActivePage);
61			
62		},time);
63		
64	}
65	
66	function setNexInterval(page)
67	{
68		startInverval( parseInt(jQuery("#banner-page-cell_" + page).attr('time')) );
69	}
70
71	function getBannerHeight()
72	{
73		return jQuery("#banner-body img").outerHeight();
74	}
75	
76	function stopInterval()
77	{
78		if(bannerTimer)
79		{
80			bannerTimer.pause();
81			bannerTimer = null;
82		}
83	}
84	
85	function moveBanner(page , instant)
86	{
87		bannerActivePage = page;
88
89		var topValue = -getBannerHeight() * (bannerActivePage-1);
90		
91		jQuery(".banner-page-cell").removeClass('background-color-level-2');
92		
93		jQuery("#banner-page-cell_" + page).addClass('background-color-level-2');
94		
95		if(instant === true) jQuery("#banner-body").css("top" ,  topValue + "px" );
96		else jQuery("#banner-body").animate({top : topValue + "px"});
97	}
98});
99
100
101jQuery(function()// PROGRAMS DESCRIPTION TOGGLE
102{
103	var activeDescription;
104	var activeButton;
105	var activeCell;
106	
107	jQuery(".programs-cell").each(function()
108	{
109		var cell = jQuery(this)
110		
111		var description = jQuery(this).find(".programs-description");
112		
113		var fullText = description.html();
114		
115		var limit = 40;
116		
117		
118		if(jQuery(this).hasClass('large')) limit = 80;
119		
120		description.attr("full-text",fullText);
121		
122		description.html(cutDescription(fullText,limit));
123		
124
125		description.fadeIn(600);
126		
127		jQuery(this).find(".read-more").click(function()
128		{
129			description.toggleClass('active');
130
131			if(activeButton)
132			{
133				if(jQuery(this).hasClass('selected'))
134				{
135					closeActives();
136					return;
137				}
138				
139				closeActives();
140			}
141			
142			activeCell = cell;
143			activeDescription = description;
144			activeButton = jQuery(this);
145			
146			description.html(description.attr("full-text"));
147			
148			activeButton.addClass('selected');
149			
150		});
151		
152	});
153	
154	function closeActives()
155	{
156		var limit = 0;
157		
158		if(activeCell.hasClass('large'))limit = 130;
159		
160		activeDescription.html(cutDescription(activeDescription.attr("full-text"),limit));
161		activeButton.removeClass('selected');
162		
163		activeDescription = null;
164		activeButton = null;
165		activeCell = null;
166	}
167	
168	function cutDescription(text , limit)
169	{
170		var newText = "";
171		
172		if (text.lenght > 0) {
173			for(var i = 0; i < limit ; i++)
174			{
175				newText += text[i];
176			}
177		}		
178		
179		return newText + "... ";
180	}
181});
182
183
184

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.