PageSourceSearch

https://liveportugal.pt/wp-content/themes/mi-playground-3/assets/js/script.js?ver=1790294840

js liveportugal.pt collected 2026-09-25 00:07:40 UTC 5,452 bytes, 171 lines download raw bytes

1function getParameterByName(name, url) {
2	if (!url) url = window.location.href;
3	name = name.replace(/[\[\]]/g, '\\$&');
4	var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
5		results = regex.exec(url);
6	if (!results) return null;
7	if (!results[2]) return '';
8	return decodeURIComponent(results[2].replace(/\+/g, ' '));
9}
10
11(function( $ ) {
12	
13	// Atualizar data para a atual
14	$(".copyright-year").text(new Date().getFullYear());
15	
16	
17	/* --- Parallax --- */
18	var rellax = new Rellax('.parallax-up-5', {speed: 5, center: true});
19	var rellax = new Rellax('.parallax-up-4', {speed: 4, center: true});
20	var rellax = new Rellax('.parallax-up-3', {speed: 3, center: true});
21	var rellax = new Rellax('.parallax-up-2', {speed: 2, center: true});
22	var rellax = new Rellax('.parallax-up-1', {speed: 1, center: true});
23		
24	var rellax = new Rellax('.parallax-down-5', {speed: -5, center: true});
25	var rellax = new Rellax('.parallax-down-4', {speed: -4, center: true});
26	var rellax = new Rellax('.parallax-down-3', {speed: -3, center: true});
27	var rellax = new Rellax('.parallax-down-2', {speed: -2, center: true});
28	var rellax = new Rellax('.parallax-down-1', {speed: -1, center: true});
29	
30	
31	// is hp
32	var is_HP = true; //false to check if homepage
33	if( $('body.home').length ){
34	  is_HP = true;
35	}
36	
37	/* --- Menu functions --- */
38	
39	if ($(window).scrollTop() >= 50 || !is_HP) {
40		$('header').removeClass("transparent");
41	} else {
42		$('header').addClass("transparent");
43	}
44	
45	$(window).scroll(function () {
46	   if ($(window).scrollTop() >= 50 || !is_HP) {
47		   $('header').removeClass("transparent");
48	   } else {
49			$('header').addClass("transparent");
50	   }
51	});
52	
53	$('header li.menu-item-has-children').on("click", function(e){
54		e.preventDefault();
55		$('header li.menu-item-has-children').not(this).removeClass("active");
56		$(this).toggleClass("active");
57	});
58	
59	$("header .sub-menu a").on("click", function(e){
60		window.location = $(this).attr("href");
61	});
62	
63	$('button.hamburger').on("click", function(){
64		$(this).toggleClass("is-active");
65		$(".menu-header").toggleClass("open");
66	});
67
68		/* --- Blog AJAX requests --- */
69	
70		/* global ajax_var */
71		
72			
73		function get_posts_ajax_call(){
74			var form_serialized = $("#blog-form").serialize();
75			var form_action = $('#blog-form').attr('action');
76			var window_location = window.location.href;
77			$.ajax( {
78				url: ajax_var.url,
79				type: 'post',
80				data: form_serialized+"&action="+form_action,
81				beforeSend: function(xhr) {
82					$(".hp-articles").addClass("loading");
83				},
84				success( data ) {},
85			} ).then(function(data){
86				$(".hp-articles").html(data);
87				$(".hp-articles").removeClass("loading");
88				window.history.replaceState(null, null, window_location.substring(0,window_location.indexOf("?"))+"?"+form_serialized.substring(0,form_serialized.indexOf("pp_page")-1));
89			});
90		}
91
92		if(window.location.search){
93			var k = getParameterByName('k');
94			var c = getParameterByName('c');
95			var pg = getParameterByName('pg');
96
97			$('#search-query').val(k);
98			$('#category-id').val(c);			
99			$('#page-number').val(pg);
100
101			get_posts_ajax_call();
102		}
103				
104		$("body").on('click', ".blog-cats", function(){
105			$(".blog-cats").removeClass("active");
106			$(this).addClass("active");
107
108			$('#category-id').val($(this).attr("data-cat-id"));		
109			$('#page-number').val('1');
110
111			get_posts_ajax_call();
112		});
113			
114		
115		$("body").on('click',".grid-page", function(){
116			$('#page-number').val($(this).attr("data-page"));
117			get_posts_ajax_call();	
118		});
119		
120		
121		$("body").on('keyup',".blog-search-box", function(e){
122			$('#search-query').val($(this).val());
123			if (e.key === 'Enter' || e.keyCode === 13) {
124				$('#page-number').val('1');
125				get_posts_ajax_call();
126			}
127		});
128		
129		$("body").on('click',".search-icon", function(e){
130			e.preventDefault();
131			$('#search-query').val($(this).attr());
132			$('#page-number').val('1');
133			get_posts_ajax_call();
134		});
135	
136	
137	$('.other-tours-carousel').owlCarousel({
138        autoplay: false,
139  	loop: true,
140    dots: true,
141    nav: true,
142    navText: ['<span class="about-us-arrows about-us-left-arrow"><svg xmlns="http://www.w3.org/2000/svg" width="27" height="16" viewB
142ox="0 0 27 16"><path d="M19.924.138a.44.44 0 0 0-.62-.02.475.475 0 0 0-.02.631l6.274 6.806H.436A.44.44 0 0 0 0 7.999a.44.44 0 0 0 .436.445h25.122l-6.274 6.805a.472.472 0 0 0 .02.632c.168.16.437.164.62-.02l6.968-7.556a.485.485 0 0 0 0-.61L19.924.137z" fill-rule="nonzero"></path></svg></span>','<span class="slider-counter"></span><span class="about-us-arrows about-us-left-arrow"><svg xmlns="http://www.w3.org/2000/svg" width="27" height="16" viewBox="0 0 27 16"><path d="M19.924.138a.44.44 0 0 0-.62-.02.475.475 0 0 0-.02.631l6.274 6.806H.436A.44.44 0 0 0 0 7.999a.44.44 0 0 0 .436.445h25.122l-6.274 6.805a.472.472 0 0 0 .02.632c.168.16.437.164.62-.02l6.968-7.556a.485.485 0 0 0 0-.61L19.924.137z" fill-rule="nonzero"></path></svg></span>'],
143    onInitialized: counter_other_tours,
144  	onChanged: counter_other_tours,
145        margin:30,
146        responsive:{
147            0:{
148                items:1
149            },
150            600:{
151                items:1
152            },
153            1000:{
154                items:3
155            }
156        }
157    });
158	
159	
160
161function counter_other_tours(event) {
162  if (!event.namespace) {
163    return;
164  }
165  var slides = event.relatedTarget;
166  jQuery('.slider-counter').text(slides.relative(slides.current()) + 1 + '/' + slides.items().length);
167}
168	
169
170
171})( jQuery );

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.