PageSourceSearch

https://forum.pt/templates/shaper_newedge/js/forum.js

js forum.pt collected 2026-10-02 03:41:52 UTC 14,586 bytes, 434 lines download raw bytes

1jQuery.noConflict();
2jQuery(window).load(function(){
3
4jQuery('<div title="subir página" class="goTop"><i class="fa fa-angle-up" aria-hidden="true"></i></div>').appendTo('#sp-footer2 div.custom');
5
6jQuery('.ui-dialog-titlebar-close').click(function (e) {
7	e.preventDefault();
8	jQuery('.ui-dialog').hide();
9	jQuery('.ui-widget-overlay').hide();
10});
11
12
13	jQuery(".goTop").on('click', function (e) {
14		e.preventDefault();
15		jQuery('html, body').animate({ scrollTop: 0 }, 1200);
16		return false;
17	});
18
19jQuery(window).scroll(function() {
20	// console.log( jQuery(this).scrollTop() );
21	if (jQuery(this).scrollTop()<=150) {
22		jQuery('.goTop').hide(1000).addClass('top').removeClass('on-view bottom mobile');
23	}
24	if (jQuery(this).scrollTop()>250) {
25		jQuery('.goTop').show(1000).addClass('on-view').removeClass('top bottom mobile');
26	}
27	if (jQuery(this).scrollTop()>2000) {
28		jQuery('.goTop').show(1000).addClass('bottom');
29	}
30	if (jQuery(this).scrollTop()>10000) {
31		jQuery('.goTop').show(1000).addClass('mobile');
32	}
33});
34
35
36jQuery('span.phoneN').each(function() { 
37		var a = jQuery(this).text();
38		jQuery('.phoneN').wrapInner('<a href="tel:'+a+'" class="button button-square"></a>');
39	});
40/**/
41
42	jQuery('html').removeClass('gafancybox-lock');
43	jQuery('html').css('overflow', 'auto');
44
45if (jQuery("body").hasClass("view-article")) {
46		jQuery('.gafancybox-overlay').css('display', 'none');
47		jQuery('.gafancybox-overlay').hide();
48	}
49
50if (jQuery("body").is( ".view-article" )) {
51	jQuery(".gafancybox-overlay").hide();
52	jQuery('html').css('overflow', 'auto');
53	jQuery('html').removeClass('gafancybox-lock');	
54}
55
56var tipo = jQuery('.offcanvas-menu-toggler.collapsed').parent('li.active');
57if(jQuery(tipo).hasClass('active')){
58	jQuery(tipo).find('ul').addClass('in');
59	jQuery(tipo).find('i.fa-plus').hide();
60	jQuery(tipo).find('i.fa-minus').show();
61}
62
63if (jQuery("#ariQueMainAnsContainer").is( ".aq-one-page-quiz" )) {
64	jQuery(".aq-progress-panel").hide();
65}
66	jQuery('#quizForm a').addClass('btn-warning');
67
68	url = window.location.href;
69	if (url === 'https://forum.pt/desporto'){
70		window.location.href = "https://forum.pt/noticias/desporto/";
71	}
72	// jQuery("#g-navigation").sticky({ topSpacing: 0 });
73	// jQuery.cookie('cross-site-cookie', 'name', ['samesite' => 'None', 'secure' => true]);	
74	if (location.protocol != 'https:') {
75		location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
76	}
77});
78
79var toSSL = function() {
80	var host = location.host;
81	jQuery('a[*=' + host + ']', 'body').each(function() {
82	
83		var $a = jQuery(this);
84		var href = $a.attr('href');
85		
86		if(href.indexOf('https') == -1) {
87		
88			var ssl = href.replace('http', 'https');
89			$a.attr('href', ssl);
90		
91		}
92	
93	});
94};
95
96
97jQuery(function() {
98	/* Check width on page load*/
99	if ( jQuery(window).width() < 370) {
100		jQuery('body').addClass('mobile');
101	}
102	jQuery(window).resize(function() {
103		/*If browser resized, check width again */
104		if (jQuery(window).width() < 370) {
105			jQuery('body').addClass('mobile');
106			//location.reload();
107		}
108		else {
109			jQuery('body').removeClass('mobile');
110		}
111	});
112
113//jQuery('#sppb-addon-1565860584705 > div > div > div > div:nth-child(1) > div > div:nth-child(1) > a > div').addClass('cat_title');
114
115jQuery('#pesqA').addClass('btn btn-primary');
116
117jQuery(".sppb-article-img-wrap div").addClass('cat_title');
118
119jQuery(".cat_title").text(function () {
120	return jQuery(this).text().replace("Capital Jovem da Segurança Rodoviária", "CJSR"); 
121})
122jQuery("#example_filter > label").text(function () {
123	return jQuery(this).text().replace("Procurar", "Filtar Resultados");
124})
125
126jQuery("#botaoCurso").each(function() {
127	var text = jQuery(this).html();
128	text = text.replace("(", "<span class='badge'>");
129	jQuery(this).html(text);
130});
131jQuery("#botaoCurso").each(function() {
132	var text = jQuery(this).html();
133	text = text.replace(")", "</span>");
134	jQuery(this).html(text);
135});
136
137jQuery("#botaoInst").each(function() {
138	var text = jQuery(this).html();
139	text = text.replace("(", "<span class='badge'>");
140	jQuery(this).html(text);
141});
142jQuery("#botaoInst").each(function() {
143	var text = jQuery(this).html();
144	text = text.replace(")", "</span>");
145	jQuery(this).html(text);
146});
147
148
149jQuery("#botaoCurso").addClass('btn btn-primary').css('border', '0px');
150jQuery("#botaoInst").addClass('btn btn-primary').css('border', '0px');
151jQuery('#example > tbody > tr > td:nth-child(3) > a').addClass('btn btn-primary btn-xs');
152
153/*
154
155#sppb-addon-1568823189110 > div > div > div > div:nth-child(1) > div > div:nth-child(1) > a > div
156#sppb-addon-1565860584705 > div > div > div > div:nth-child(1) > div > div:nth-child(1) > a > div
157jQuery(function() {
158	//alert('running');
159	jQuery('.owl-item').each(function() { // For each image
160		var a = jQuery(this).children('.latest-post a'); // Find its associated anchor
161		//alert(a);
162		jQuery(this).wrap('<a href="' + a.attr('href') + '"></a>'); // And wrap the image
163	});
164});
165*/
166
167	jQuery('.pagenavcounter').insertAfter('div.pager').css('textAlign', 'center');
168	jQuery('<i class="icon-search top-icon"></i>').insertBefore('#mod-ajaxsearch-searchword');
169	jQuery('#mod-ajaxsearch-searchword').attr('size',21);
170
171	jQuery('.et-addontitle div').addClass('cat-title');
172	// insere title no link para detalhe de artigo
173	jQuery('div.sppb-article-info-wrap > h3 > a:not([title])').each(function(){
174		jQuery(this).attr('title',jQuery(this).text());  //or use $.trim($(this).text()) to remove white spaces.
175	});
176
177/*Esconder Alertas após 6 seg */
178	setTimeout(function () {
179		if (jQuery(".alert").is(":visible")){
180			//you may add animate.css class for fancy fadeout
181			jQuery(".alert").fadeOut("slow");
182		}
183	}, 8000)
184});
185
186
187jQuery(function () {
188	/*
189	jQuery(jQuery("input.aq-multiplesummingquestion-ctrl:checked").get().reverse()).each(function() {
190		var option = [];
191		//console.log(jQuery(this).prev().text());
192		var option = jQuery(this).prev().text();
193		var label = jQuery(this).parent().next('.aq-answer').text();
194
195		jQuery('<div class="results"><b>'+label+':</b> '+option+'</div>').insertAfter('.quizResults');
196	});
197
198	jQuery(jQuery("input.aq-singlequestion-ctrl:checked").get().reverse()).each(function() {
199		var option = [];
200		//console.log(jQuery(this).prev().text());
201		var option = jQuery(this).prev().text();
202		jQuery(option).serializeArray()
203		var option = option.replace('Opção', '');
204		//console.log(option);
205		//var label = jQuery(this).parent().next('.aq-answer').text();
206		//jQuery('<div class="results"><b>'+label+':</b> '+option+'</div>').insertAfter('.quizResults');
207	});
208*/
209jQuery('#ariQuizContainer .aq-answer-container').addClass('col-sm-6');
210/*
211jQuery('<div id="myDiv"></div><button title="Vê aqui a tua Academia" class="btn btn-primary" id="GetAcademia">Escolhe aqui a tua Academia</button>').insertAfter('.quizResults');
212
213jQuery("#GetAcademia").click(function(e){
214	e.preventDefault();
215	var buttonValue = jQuery(".aq-question-answers input.aq-singlequestion-ctrl:checked").prev().text();
216	//var buttonValue = jQuery(buttonValue).serializeArray();
217	var buttonValue = buttonValue.replace('Opção', '');
218	// var buttonValue = option;
219	jQuery("#myDiv").load('https://forum.pt/templates/shaper_newedge/js/results.php', {selectedButtonValue : buttonValue});
220	//jQuery("#myDiv").load('myPHPfile.php', {selectedButtonValue : buttonValue});
221//	jQuery("#myDiv").load("https://i9web.pt/forumsite/templates/shaper_newedge/js/results.php");
222});
223*/
224jQuery("#GetAcademia").click(function(e){
225	e.preventDefault();
226	var buttonValue = jQuery(".aq-question-answers input.aq-multiplesummingquestion-ctrl:checked").prev().text();
227	//var buttonValue = jQuery(buttonValue).serializeArray();
228	var buttonValue = buttonValue.replace('Opção', '');
229	// var buttonValue = option;
230	jQuery("#myDiv").load('https://forum.pt/templates/shaper_newedge/js/results.php', {selectedButtonValue : buttonValue});
231});
232
233jQuery('a.aq-quiz-link').addClass('btn btn-primary');
234jQuery('.aq-quizzes li').css('margin', '4px 0');
235
236
237
238	jQuery('a[href^="http://"]').not('a[href*="forum.pt"]').attr('target','_blank');
239
240	jQuery(".sppb-article-introtext").each(function () {
241			len = jQuery(this).text().length;
242			str = jQuery(this).text().substr(0,100);
243			lastIndexOf = str.lastIndexOf(" ");
244			
245			if(len>100) {
246				jQuery(this).text(str.substr(0, lastIndexOf) + "... ");
247			}
248			/*if(len<80) {
249				jQuery(this).text(str.substr(0, lastIndexOf) + "  - " + len );
250			}*/
251
252		});
253
254// Limite de artigos em categorias + load more
255	jQuery('<div style="display:block; width:100%;text-align:center;"><a title="Carregar mais" class="btn btn-primary" href="#" id="loadMore"><i class="fa fa-plus fa-3" aria-hidden="true"></i></a></div>').insertAfter('body.catNews #sppb-addon-1565865695140 > div > div > div > div:last-child');
256	jQuery('a#loadMore').css('margin', '4rem auto');
257	jQuery('<div id="overlay"><div class="cv-spinner"><span class="spinner"></span></div></div>').insertAfter('#loadMore');
258
259	jQuery(function () {
260		jQuery("body.catNews #sppb-addon-1565865695140 > div > div > div > div").slice(0, 8).show().css('visible', 'visible');
261
262		jQuery("#loadMore").on('click', function (e) {
263			e.preventDefault();
264			jQuery("#overlay").fadeIn(300);
265			jQuery("body.catNews #sppb-addon-1565865695140 > div > div > div > div:hidden").slice(0, 8).slideDown();
266			if (jQuery("body.catNews #sppb-addon-1565865695140 > div > div > div > div:hidden").length == 0) {
267				jQuery("#load").fadeOut('slow');
268			}
269			jQuery('html,body').animate({
270				scrollTop: jQuery(this).offset().top
271			}, 1400);
272			jQuery("#overlay").fadeOut(300);
273		});
274
275});
276
277
278
279
280});
281jQuery(function(){
282// empty
283});
284
285
286// Valida Palavra-passe
287
288jQuery(function(){
289	jQuery("<span id=\"result\"></span>").insertAfter('#password');
290	jQuery('#result').css({
291		height: '2px',
292		float:'left',
293		display: 'block',
294		position: 'relative',
295		textTransform:'uppercase',
296		top: '4px',
297		fontSize: '10px',
298		padding: '0px 4px',
299		textAlign: 'right',
300		color: '#555',
301		fontWeight: 'bold',
302		WebkitTransition : 'all 1s ease-in-out',
303		MozTransition    : 'all 1s ease-in-out',
304		MsTransition     : 'all 1s ease-in-out',
305		OTransition      : 'all 1s ease-in-out',
306		transition       : 'all 1s ease-in-out'
307	});
308	jQuery('#password').keyup(function() {
309		jQuery('#result').html(checkStrength(jQuery('#password').val()))
310	})
311	function checkStrength(password) {
312		var strength = 0
313		if (password.length < 6) {
314			jQuery('#result').removeClass()
315			jQuery('#result').addClass('short')
316			jQuery('#result.short').css({
317				background: 'red',
318				width: 'auto'
319			});
320			return 'Senha demasiado curta!'
321		}
322		if (password.length > 7) strength += 1
323		// If password contains both lower and uppercase characters, increase strength value.
324		if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) strength += 1
325		// If it has numbers and characters, increase strength value.
326		if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) strength += 1
327		// If it has one special character, increase strength value.
328		if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
329		// If it has two special characters, increase strength value.
330		if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
331		// Calculated strength value, we can return messages
332		// If value is less than 2
333		if (strength < 2) {
334			jQuery('#result').removeClass()
335			jQuery('#result').addClass('weak')
336			jQuery('#result.weak').css({
337				background: 'orange',
338				width: '40%'
339			});
340			return 'Senha fraca!'
341		} else if (strength == 2) {
342			jQuery('#result').removeClass()
343			jQuery('#result').addClass('good')
344			jQuery('#result.good').css({
345				background: 'limegreen',
346				width: '55%'
347			});
348			return 'Senha Ok!!'
349		} else {
350			jQuery('#result').removeClass()
351			jQuery('#result').addClass('strong')
352			jQuery('#result.strong').css({
353				background: 'forestgreen',
354				width: '100%'
355			});
356			return 'Senha forte!!!'
357		}
358	}
359});
360
361jQuery(function(){
362	jQuery("<span id=\"result\"></span>").insertAfter('#jform_password1');
363	jQuery('#result').css({
364		height: '2px',
365		float:'left',
366		display: 'block',
367		position: 'relative',
368		textTransform:'uppercase',
369		top: '4px',
370		fontSize: '10px',
371		padding: '0px 4px',
372		textAlign: 'right',
373		color: '#555',
374		fontWeight: 'bold',
375		WebkitTransition : 'all 1s ease-in-out',
376		MozTransition    : 'all 1s ease-in-out',
377		MsTransition     : 'all 1s ease-in-out',
378		OTransition      : 'all 1s ease-in-out',
379		transition       : 'all 1s ease-in-out'
380	});
381
382	jQuery('#jform_password1').keyup(function() {
383		jQuery('#result').html(checkStrength(jQuery('#jform_password1').val()))
384	})
385	function checkStrength(password) {
386		var strength = 0
387		if (password.length < 6) {
388			jQuery('#result').removeClass()
389			jQuery('#result').addClass('short')
390			jQuery('#result.short').css({
391				background: 'red',
392				width: 'auto'
393			});
394			return 'Senha demasiado curta!'
395		}
396		if (password.length > 7) strength += 1
397		// If password contains both lower and uppercase characters, increase strength value.
398		if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) strength += 1
399		// If it has numbers and characters, increase strength value.
400		if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) strength += 1
401		// If it has one special character, increase strength value.
402		if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
403		// If it has two special characters, increase strength value.
404		if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) strength += 1
405		// Calculated strength value, we can return messages
406		// If value is less than 2
407		if (strength < 2) {
408			jQuery('#result').removeClass()
409			jQuery('#result').addClass('weak')
410			jQuery('#result.weak').css({
411				background: 'orange',
412				width: '40%'
413			});
414			return 'Senha fraca!'
415		} else if (strength == 2) {
416			jQuery('#result').removeClass()
417			jQuery('#result').addClass('good')
418			jQuery('#result.good').css({
419				background: 'limegreen',
420				width: '55%'
421			});
422			return 'Senha Ok!!'
423		} else {
424			jQuery('#result').removeClass()
425			jQuery('#result').addClass('strong')
426			jQuery('#result.strong').css({
427				background: 'forestgreen',
428				width: '100%'
429			});
430			return 'Senha forte!!!'
431		}
432	}
433});
434

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.