PageSourceSearch

https://mia-platform.eu/wp-content/themes/mia-platform/static/js/qzr-script.js?ver=1790910210

js mia-platform.eu collected 2026-10-02 06:01:59 UTC 7,408 bytes, 229 lines download raw bytes

1document.querySelectorAll('.single-blognews .anchors .anchor').forEach(function(el){
2	el.addEventListener('click', function() {
3		var index = parseInt(el.getAttribute('data-index'));
4		var title = document.querySelectorAll('h2')[index];
5		window.scroll({top: title.offsetTop - 100, left: 0, behavior: 'smooth'});
6	});
7});
8
9
10document.querySelectorAll('.single-blognews .back-to-start').forEach(function(el){
11	el.addEventListener('click', function() {
12		window.scroll({top: 0, left: 0, behavior: 'smooth'});
13	});
14});
15
16
17window.onscroll = function() {
18	$h2 = document.querySelectorAll('.single-blognews .content h2')
19	var index = -1;
20	
21	if( $h2.length > 0 ){
22		$h2.forEach(function(el, i){
23			if(el.getBoundingClientRect().top <= 105){
24				index = i
25			}
26		});
27		
28		$anchors = document.querySelectorAll('.single-blognews .anchors .anchor');
29		$anchors.forEach(function(el){ el.classList.remove('current'); });
30		
31		if(index != -1){
32			$anchors[index].classList.add('current'); 
33		}
34	}
35	document.documentElement.style.setProperty('--window-scroll', `${window.scrollY}px`);
36	setProgressBar();
37
38	updateAnchorMenu();
39};
40
41function setProgressBar(){
42	if(document.querySelector(".single-blognews") != null ){
43		var h = document.documentElement, 
44		b = document.body,
45		st = 'scrollTop',
46		sh = 'scrollHeight';
47		var percent = Math.min(100, (h[st]||b[st]) / ((document.querySelector(".back-to-start").getBoundingClientRect().top  + window.scrollY) - h.clientHeight) * 100)
48		document.querySelectorAll('.progress-bar .inner').forEach(function(el){
49			el.style.width = (100-percent)+'%';
50		});
51	}
52}
53
54
55document.querySelectorAll('.block-services_grid .show-more.button').forEach(function(el){
56	el.addEventListener('click', function() {
57		var items = parseInt(el.getAttribute('data-items'));
58		var categories = document.querySelectorAll('.block-services_grid .category.hidden');
59		
60		for(var i=0; i<items; i++){
61			categories[i].classList.remove('hidden'); 
62		}
63	});
64});
65
66
67
68var latestSearch = '';
69const $search = document.querySelectorAll('.autocomplete-search input');
70
71if($search.length > 0){
72	$search.forEach(function(el){
73		el.addEventListener('keyup', autocompleteSearchPost);
74	})
75}
76
77function autocompleteSearchPost(e){
78	var $searchpanel = this.nextSibling;
79	while(!$searchpanel.classList || !$searchpanel.classList.contains('search-panel')){
80		$searchpanel = $searchpanel.nextSibling;
81	}
82	
83	if(e.keyCode==13 || !$searchpanel.classList.contains('search-panel')) return;
84	
85	var searchTerm = this.value;
86	var	link = baseUrl + '?s='+encodeURI(searchTerm);
87	var type = this.getAttribute('data-type');
88
89	if(searchTerm.length>2){
90		if(searchTerm!=latestSearch){
91			latestSearch = searchTerm;
92			$searchpanel.innerHTML = '';
93
94			fetch(baseUrl+'/wp-json/wp/v2/'+type+'?lang='+current_language+'&search='+searchTerm)
95			   .then(response => response.json())
96			   .then(function (response) {
97					$searchpanel.innerHTML = '';
98					
99					if(response.length>0){
100						response.forEach(function(result){
101							$searchpanel.innerHTML += '<a class="search-link" href="'+result.link+'">'+result.title.rendered+'</a>';
102						})
103					} else {
104						$searchpanel.innerHTML = '<p>'+empty_search_string+'</p>';
105					}
106				})
107		}
108	} else {
109		$searchpanel.innerHTML = '';
110	}
111	e.preventDefault();
112}
113
114document.querySelectorAll('.block-logos_list:has(.logos-carousel-source),.block-images_list:has(.logos-carousel-source)').forEach(function(block){
115	let slots = block.querySelectorAll('.item-col'),
116		logosNr = slots.length;
117	for(let i = 0; i < logosNr; i++){
118		let logo = pickRandomLogoFromCarouselSource(block);
119		setLogoInCarouselSlot(slots[i],logo);
120	}
121	setTimeout(swapLogoInCarousel, parseInt(block.querySelector('.logos-carousel-source').getAttribute('data-delay')), block);
122})
123function setLogoInCarouselSlot(slot,logo){
124	slot.appendChild(logo.element);
125	slot.setAttribute('data-index',logo.index);
126	setTimeout(function(){
127		slot.classList.add('visible');
128	},1);
129	updateLogoImageHeight(slot.querySelector('.image-wrapper'));
130}
131function swapLogoInCarousel(block){
132	let slots = block.querySelectorAll('.item-col'),
133		logosNr = slots.length,
134		random = Math.floor(Math.random() * logosNr),
135		logo = pickRandomLogoFromCarouselSource(block),
136		currentSlot = slots[random];
137
138    block.querySelectorAll('.logo-source')[currentSlot.getAttribute('data-index')].classList.remove('current');
139    currentSlot.classList.remove('visible');
140
141    setTimeout(function(){
142        currentSlot.innerHTML = '';
143        setLogoInCarouselSlot(currentSlot, logo);
144    }, parseInt(block.querySelector('.logos-carousel-source').getAttribute('data-fade')));
145
146    setTimeout(swapLogoInCarousel, parseInt(block.querySelector('.logos-carousel-source').getAttribute('data-delay')), block);
147}
148function updateLogoImageHeight(logo){
149	let width = parseInt(logo.getAttribute('data-width')),
150		height = parseInt(logo.getAttribute('data-height'));
151	logo.removeAttribute('style');
152	let max = Math.round(height * logo.offsetWidth / width);
153	if (max < logo.offsetHeight) {
154		logo.setAttribute('style','max-height: '+max+'px');
155	}
156}
157function pickRandomLogoFromCarouselSource(block){
158	let sources = block.querySelectorAll('.logo-source'),
159		sourcesNr = sources.length,
160		random = Math.floor(Math.random() * sourcesNr),
161		tries = 10,
162		currentTry = 0,
163		found = false;
164	while(!found){
165		candidate = sources[random];
166		if(candidate.classList.contains('current')){
167			currentTry++;
168
169			if(currentTry>=tries) found = candidate;
170			else random = Math.floor(Math.random() * sourcesNr);
171		} else {
172			candidate.classList.add('current')
173			found = candidate;
174		}
175	}
176	return {
177		element: candidate.querySelector('.image-wrapper').cloneNode(true),
178		index: random
179	};
180}
181window.onload = function(event) {
182	if(document.querySelector('.landing-page-with-form-container')){
183		let height = document.querySelector('.block-header_landing').offsetHeight + 24;
184		document.documentElement.style.setProperty('--landing-header-height', `${height}px`);
185	}
186}
187
188
189//window.onscroll = updateAnchorMenu();
190
191function updateAnchorMenu(){
192	const menu = document.querySelector(".block-anchor_menu");
193	if(menu) {
194		anchors = document.querySelectorAll('.anchor')
195		var index = -1;
196		
197		if( anchors.length > 0 ){
198			anchors.forEach(function(el, i){
199				if(el.getBoundingClientRect().top <= 105){
200					index = i
201				}
202			});
203			
204			links = menu.querySelectorAll('.link');
205			links.forEach(function(el){ el.classList.remove('current'); });
206			
207			if(index != -1){
208				links[index].classList.add('current');
209				if(menu.querySelector(".swiper-container").swiper) menu.querySelector(".swiper-container").swiper.slideTo(index);
210			}
211		}
212		const headerHeight = window.getComputedStyle(document.documentElement).getPropertyValue('--header-height');
213		const topBannerHeight = window.getComputedStyle(document.documentElement).getPropertyValue('--top-banner-height');
214		const topBannerY = window.getComputedStyle(document.documentElement).getPropertyValue('--top-banner-y');
215		//console.log(headerHeight,topBannerHeight,topBannerY)
216
217
218		if(menu.getBoundingClientRect().top<=parseInt(headerHeight) + parseInt(topBannerHe
218ight) + parseInt(topBannerY)) menu.classList.add('sticked');
219		else menu.classList.remove('sticked');
220	}
221}
222updateAnchorMenu();
223/*
224
225document.querySelectorAll('.block-anchor_menu .link').on('click',function(e){
226	const link = $(e.currentTarget);
227    this.getSwiper().slideTo(parseInt(link.data('index')));
228})
229*/

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.