PageSourceSearch

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

js obmep.org.br collected 2026-09-24 09:54:19 UTC 11,354 bytes, 516 lines download raw bytes

1
2Shadowbox.init();
3
4
5jQuery(function() //Header Buttons
6{
7	setupTablesDropDown();
8
9	setupDefaultDropDown(jQuery(".header-menu-button"),"left" );
10	
11	jQuery('.start-hidden').fadeIn(200);
12});
13
14var blockedAlert = false;
15
16
17function openAlert(alertName , blocked  )
18{
19	var alertBackground = jQuery("#black-screen #alert-background");
20	var ajaxContainer = jQuery("#black-screen #alert-background #ajax");
21
22	ajaxContainer.html("");
23	jQuery("#black-screen").show(0);
24	jQuery("#black-screen #loading").show(0);
25
26	alertBackground.width(128);
27	alertBackground.height(128);
28	alertBackground.hide(0).fadeIn(200);
29
30	blockedAlert = blocked;
31
32	if(!alertName) return;
33
34	setTimeout(function() // Aumentando o tempo de carregamento para faciliar a visualização do estilo de loading
35	{
36		ajaxContainer.load('storage/fake-ajax/' + alertName + ".html",function()
37		{
38			jQuery("#black-screen #loading").hide(0);
39
40			alertBackground.css("position","static");
41			alertBackground.height("auto");
42			alertBackground.width("400px");
43
44			var alertHeight = alertBackground.height();
45
46			ajaxContainer.hide(0);
47
48			alertBackground.css("position","absolute");
49			alertBackground.height(128);
50			alertBackground.width(128);
51
52			alertBackground.animate( { height : alertHeight + "px", width : "400px" } , 500 , function()
53			{
54				ajaxContainer.fadeIn(200);
55			});
56		});
57	},1000);
58}
59
60function closeAlert()
61{
62	jQuery("#black-screen").fadeOut(200);
63
64}
65
66function blackScreenClose()
67{
68	if(!blockedAlert)closeAlert();
69}
70
71function setupTablesDropDown() 
72{
73	jQuery("table").each(function()
74	{
75		jQuery(this).find(".drob-button").each(function()
76		{
77			var el = jQuery(this);
78			
79			el.html('AÇÕES');
80			el.css('font-size','1');
81			el.addClass('background-color-level-2');
82			el.addClass('background-hcolor-level-3');
83			el.addClass('dark-background');
84			el.addClass('button-mode');
85			
86			el.hide(0).fadeIn(300);
87			
88			setupTAGDropDown(el,"right");
89		});
90	});
91}
92
93function setupDefaultDropDown(el  , side  ) 
94{
95	var dropContainer;
96	var activeButton;
97	
98	el.hover(
99	function()
100	{
101		if(dropContainer) return;
102		
103		var dButton = jQuery(this).find('.drob-button');
104		
105		dropContainer = document.createElement("DIV");
106		dropContainer.id = "header-menu-drop-container";
107		
108		dropContainer.style.top =  (jQuery(this).outerHeight()) + 'px';
109		
110		if(side == 'sub')
111		{
112			dropContainer.style.left = (dButton.outerWidth())  + "px";
113			dropContainer.style.top = "0px";
114			activeButton = dButton.get(0);
115		}
116		else
117		{
118			dropContainer.style[side] =  '0px';
119			activeButton = jQuery(this).get(0);
120		}
121		
122		activeButton.style.position = "relative";
123		activeButton.appendChild(dropContainer);
124		
125		var rawOptions = jQuery(this).attr("drop-options");
126		rawOptions = rawOptions.split(",");
127		
128		var colorLevel = [3,4];
129		if(side == "sub") colorLevel = [4,2];
130		
131		for(var i = 0; i < rawOptions.length ; i++)
132		{
133			var buttonOptions = rawOptions[i].split('|');
134			
135			var newButton = document.createElement("A");
136			newButton.href = buttonOptions[1];
137			
138			
139			var buttonClass = 'drob-button background-color-level-' + colorLevel[0] + ' background-hcolor-level-' + colorLevel[1];
140			
141			
142			if(buttonOptions[2])
143			{
144				newButton.setAttribute("drop-options", jQuery(this).attr(buttonOptions[2]) );
145				
146				setupDefaultDropDown(jQuery(newButton),'sub');
147				
148				buttonClass += " sub";
149			}
150			
151			newButton.innerHTML = '<div class="' + buttonClass + '">' + buttonOptions[0] + '</div>';
152			dropContainer.appendChild(newButton);
153		}
154		
155	},
156	function()
157	{
158		activeButton.removeChild(dropContainer);
159		dropContainer = null;
160		activeButton = null;
161	});
162	
163}
164
165
166function setupTAGDropDown(el  , side  ) 
167{
168	var dropContainer;
169	var activeButton;
170	
171	el.hover(
172	function()
173	{
174		if(dropContainer) return;
175		
176		dropContainer = document.createElement("DIV");
177		dropContainer.id = "header-menu-drop-container";
178		
179		if(side == 'sub')
180		{
181			dropContainer.style.top = "0px";
182			dropContainer.style.left = ( jQuery(this).outerWidth())  + "px";
183		}
184		else
185		{
186			dropContainer.style.top =  (jQuery(this).outerHeight()) + 'px';
187			dropContainer.style[side] =  '0px';
188		}
189		
190		activeButton = jQuery(this).get(0);
191		activeButton.style.position = "relative";
192		activeButton.appendChild(dropContainer);
193		
194		var rawOptions = jQuery(this).attr("drop-options");
195		rawOptions = rawOptions.split("|");
196		
197		var colorLevel = [3,4];
198		if(side == "sub") colorLevel = [4,2];
199		
200		for(var i = 0; i < rawOptions.length ; i++)
201		{
202			var newButton = document.createElement("DIV");
203			
204			var buttonClass = 'drob-button background-color-level-' + colorLevel[0] + ' background-hcolor-level-' + colorLevel[1];
205			newButton.innerHTML = rawOptions[i];
206			
207			var jButton = jQuery(newButton).find("a");
208			
209			
210			if(jButton.get().length && jButton.attr('sub'))
211			{
212				newButton.setAttribute("drop-options", jQuery(this).attr(jButton.attr('sub')) );
213				setupDefaultDropDown(jQuery(newButton),'sub');
214				
215				buttonClass += " sub";
216			}
217			
218			newButton.className = buttonClass;
219			dropContainer.appendChild(newButton);
220		}
221		
222	},
223	function()
224	{
225		activeButton.removeChild(dropContainer);
226		dropContainer = null;
227		activeButton = null;
228	});
229	
230}
231
232
233jQuery(function() //Windows Toggle
234{
235	jQuery('.windows-toggle-trigger').each(function()
236	{
237		jQuery(this).click(function()
238		{
239			var trigger = jQuery(this);
240			var open = trigger.attr("open");
241			var container = trigger.attr("container");
242			var o_html =  trigger.attr("open-html");
243			var c_html =  trigger.attr("closed-html");
244			
245			trigger.attr("open",!open)
246			
247			if(open)
248			{
249				jQuery(container).slideUp(200,function()
250				{
251					if(c_html) trigger.html(c_html);
252				})
253			}
254			else
255			{
256				jQuery(container).slideDown(200,function()
257				{
258					if(o_html) trigger.html(o_html);
259				});
260			}
261			
262		});
263		
264	});
265});
266
267
268jQuery(function() //Tables Paginator
269{
270	jQuery("table").each(function()
271	{
272		var page = 1;
273		var totalCols = jQuery(this).attr("total-cols");
274		var totalPages = jQuery(this).attr("total-pages");
275		var tableName = jQuery(this).attr("table-name");
276		var leftButtons = jQuery(this).find('.paginator th a.left');
277		var rightButtons = jQuery(this).find('.paginator th a.right');
278		var counter = jQuery(this).find('.paginator th span');
279		var content = jQuery(this).find('#content');
280		
281		var checkButtons = function()
282		{
283			if(page == 1)
284			{
285				rightButtons.show(0);
286				leftButtons.hide(0);
287			}
288			else if(page == totalPages)
289			{
290				leftButtons.show(0);
291				rightButtons.hide(0);
292			}
293			else
294			{
295				leftButtons.show(0);
296				rightButtons.show(0);
297			}
298		};
299		
300		
301		var setupPage = function()
302		{
303			counter.html(page);
304			
305			leftButtons.hide(0);
306			rightButtons.hide(0);
307			
308			var width = content.width();
309			var height = content.height() - 14;
310			
311			content.html('');
312			
313			var loadingContainer = document.createElement("TD");
314			loadingContainer.colSpan = totalCols;
315			loadingContainer.innerHTML = '<img src="images/load-table-02.gif"/>';
316			loadingContainer.className = "loading";
317			loadingContainer.style.width = width + "px";
318			loadingContainer.style.height = height + "px";
319			
320			content.get( 0 ).appendChild(loadingContainer);
321			
322			setTimeout(function() // Aumentando o tempo de carregamento para faciliar a visualização do estilo de loading
323			{
324				content.load("storage/fake-ajax/" + tableName + "-" + page+".html",function()
325				{
326					setupTablesDropDown();
327
328					content.hide(0).fadeIn(300);
329
330					checkButtons();
331				});
332			},500);
333			
334			
335		};
336		
337		if( totalPages > 1 )
338		{
339			rightButtons.fadeIn();
340			
341			leftButtons.click(function()
342			{
343				page --;
344				checkButtons();
345				
346				setupPage();
347			});
348			
349			rightButtons.click(function()
350			{
351				page ++;
352				checkButtons();
353				
354				setupPage();
355			});
356		}
357		
358	});
359	
360});
361
362jQuery(function() // Generic Ajax Loading
363{
364	var selected = null;
365	
366	jQuery(".ajax-loader-trigger").each(function()
367	{
368		if(jQuery(this).hasClass('selected')) selected = jQuery(this);
369	});
370	
371	jQuery(".ajax-loader-trigger").click(function(e)
372	{
373		e.preventDefault();
374		
375		if(selected) selected.removeClass('selected');
376		
377		jQuery(this).addClass('selected');
378		selected = jQuery(this);
379		
380		var container = jQuery("#" + jQuery(this).attr("ajax-container"));
381		var ajaxUrl = jQuery(this).attr("ajax-url");
382		var onComplete = jQuery(this).attr("on-complete");
383		
384		
385		var containterWidth = container.width();
386		var containterHeight = container.height();
387		
388		container.html('<img id="loading-img" src="images/load-table-02.gif" />');
389		container.addClass("loading");
390		
391		container.width(containterWidth);
392		container.height(containterHeight);
393		
394		
395		setTimeout(function() // Aumentando o tempo de carregamento para faciliar a visualização do estilo de loading
396		{
397			container.load( ajaxUrl , function()
398			{
399				container.removeClass("loading");
400				container.hide(0).fadeIn(300);;
401				
402				container.width("auto");
403				container.height("auto");
404				
405				if(onComplete)eval(onComplete);
406			});
407			
408			
409		},500);
410		
411	});
412	
413});
414
415
416jQuery(function() // Soft Hash Scroll
417{
418    jQuery("a").click(function (event) 
419	{
420        if(this.hash ) 
421		{ 
422            event.preventDefault();
423           
424            var dest = 0;
425			
426			var elementTop = jQuery(this.hash).offset().top;
427			
428			dest = elementTop - 50;
429			
430            jQuery('html,body').animate({ scrollTop: dest  }, 500, 'swing');
431			
432        }
433    });
434	
435});
436
437
438
439jQuery(function() // Paginator
440{
441	
442	jQuery('.default-paginator').each(function()
443	{
444		var el = jQuery(this);
445		
446		el.fadeIn(300);
447		
448		var cellPageCount = 4;
449		var page = 0;
450		var window = el.find("#paginator-window");
451		var offsetValue = window.outerWidth();
452		var body = el.find("#paginator-body");
453		var totalPage = Math.ceil( el.find(".cell").length / cellPageCount );
454		var leftButton = el.find("#page-left");
455		var rightButton = el.find("#page-right");
456		
457		var config = function()
458		{
459			if(!page) leftButton.css("visibility","hidden");
460			else  leftButton.css("visibility","visible");
461			
462			if(page == totalPage-1)rightButton.css("visibility","hidden");
463			else rightButton.css("visibility","visible");
464		};
465		
466		var move = function() {  body.animate({ marginLeft : "-" + (page * offsetValue ) + "px"}); }
467		
468
469		config();
470		
471		leftButton.click(function()
472		{
473			page --;
474			config();
475			move();
476		});
477		
478		rightButton.click(function()
479		{
480			page ++;
481			config();
482			move();
483		});
484		
485	});
486	
487	
488});
489
490
491function RecurringTimer(callback, delay) 
492{
493    var timerId, start, remaining = delay;
494
495    this.pause = function() {
496        window.clearTimeout(timerId);
497        remaining -= new Date() - start;
498    };
499
500    var resume = function() {
501        start = new Date();
502        timerId = window.setTimeout(function() {
503            remaining = delay;
504            resume();
505            callback();
506        }, remaining);
507    };
508
509    this.resume = resume;
510
511    this.resume();
512}
513
514
515
516

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.