PageSourceSearch

https://restaurantleglise.nl/wp-content/themes/leglise/_inc/_js/site-scripts.js?ver=0.77

js restaurantleglise.nl collected 2026-10-07 11:28:07 UTC 33,573 bytes, 1,130 lines download raw bytes

1var doc_body, EL_window, EL_logo, EL_scroll_notice, EL_header, EL_to_top, EL_nav_wrap,cur_page_size;
2var scroll_notice_active = false;
3var mobile_breakpoint = 700;
4var window_scroll = {
5	top: 0,
6	dir: null
7}
8var window_dims = {
9	width: window.outerWidth,
10	height: window.outerHeight
11}
12var is_safari = navigator.userAgent.indexOf("Safari") > -1;
13
14jQuery(document).ready(function($) {
15	console.log('hi iam mm scripts')
16	"use strict";
17	doc_body = jQuery(document.body);
18	EL_window = jQuery(window);
19
20	cur_page_size = get_page_size();	
21
22	EL_header = jQuery('header#site-header');
23	EL_to_top = jQuery('#back-to-top');
24	EL_nav_wrap = jQuery('#navs-wrapper');
25	EL_logo = jQuery('div.logo-wrap');
26
27	if(typeof check_cookie_warning !== 'undefined') { 
28		doc_body.addClass('w-cookie-warning');
29		check_cookie_warning(); 
30	}
31
32	// check_home_bg_items();
33	start_scroll_throttle();
34	start_resize_throttle();
35	trigger_main_menu();
36	trigger_bg_video();
37	trigger_google_maps();
38	// trigger_search();
39
40	// embed_vid_triggers();
41	// mm_post_item_filters();
42	trigger_page_anchors();
43
44	ajax_btns();
45
46	// trigger_readmores();
47
48	add_block_classes();
49	// move_in_page_els();
50
51	on_page_update();
52	
53	// Touch ?
54	if(touch_device) { doc_body.addClass('no-hover'); }
55});
56function on_page_update() {
57	// trigger_artwork_img_zooms();
58	// distribute_artwork_overviews();
59	// trigger_slideshows();
60	// del_wpml_msg();
61}
62function is_touch_device() {
63  return 'ontouchstart' in window   // works on most browsers 
64  || 'onmsgesturechange' in window;  // works on IE10 with some false positives
65};
66var touch_device = is_touch_device();
67
68function set_css_vars() {
69	let header_menu_h =  parseInt( jQuery('#navs-wrapper').outerHeight() );
70	document.documentElement.style.setProperty('--mmh', header_menu_h+'px');   	
71}
72function mobile_size( check_size ) {
73	if(typeof check_size === 'undefined') { check_size = mobile_breakpoint; }
74	var mobile = false;
75	if(window.innerWidth < check_size) {
76		mobile = true;
77	}
78	return mobile;
79} 
80
81function trigger_main_menu() {
82	$ = jQuery;
83	jQuery('.toggle-menu').on('click', function(e){
84
85		if(!doc_body.hasClass('menu-active')) {
86			// trigger_menu_search_outside( true );
87		}
88
89		doc_body.toggleClass('menu-active');
90		doc_body.removeClass('search-active');
91		e.preventDefault();
92	});
93	if(!mobile_size()) {
94	} else {
95		$('.page-content .inner > i').on('click', function(e){
96			window.location = mm_ajax.mm_base_url;
97		});
98		
99		var menu_w_subs = EL_nav_wrap.find('li.menu-item-has-children');
100		menu_w_subs.on('click', function(e){
101			let clckd = $(this);
102			if(clckd.hasClass('open')) {
103				clckd.removeClass('open');
104			} else {
105				menu_w_subs.removeClass('open');
106				clckd.addClass('open');
107			}
108		});
109	}
110
111
112}
113
114/*lil_         __                    
115   / /_  ___  / /___  ___  __________
116  / __ \/ _ \/ / __ \/ _ \/ ___/ ___/
117 / / / /  __/ / /_/ /  __/ /  (__  ) 
118/_/ /_/\___/_/ .___/\___/_/  /____/  
119			/*/
120function obj_len(obj) {
121	return Object.keys(obj).length;
122}
123function obj_clone(src) {
124	return JSON.parse(JSON.stringify(src));
125}
126function uniqid() {
127	var dtime = Date.now().toString(36);
128	return dtime;
129}
130///////////////////////////////////////
131function cookie_create(name, value, days) {
132    var expires;
133
134    if (days) {
135        var date = new Date();
136        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
137        expires = "; expires=" + date.toGMTString();
138    } else {
139        expires = "";
140    }
141    document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/";
142}
143
144function cookie_read(name) {
145    var nameEQ = encodeURIComponent(name) + "=";
146    var ca = document.cookie.split(';');
147    for (var i = 0; i < ca.length; i++) {
148        var c = ca[i];
149        while (c.charAt(0) === ' ') c = c.substring(1, c.length);
150        if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
151    }
152    return null;
153}
154
155function cookie_erase(name) {
156    cookie_create(name, "", -1);
157}
158
159/*                       ____
160   ___________________  / / /
161  / ___/ ___/ ___/ __ \/ / / 
162 (__  ) /__/ /  / /_/ / / /  
163/____/\___/_/   \____/_/*/
164var page_is_scrolling = false;
165var raf_retrigger;
166var prev_scroll_top = 0;
167var min_delta_direction_switch = 30;
168
169function start_animation_frames() {
170	// console.log('start_animation_frames');
171	raf_retrigger = false;
172	// Check dat scrolling
173	window_scroll.top = jQuery(window).scrollTop();
174	var scroll_delta = prev_scroll_top - window_scroll.top;
175	// console.log(scroll_delta);
176	// Set scroll direction
177	if( Math.abs(scroll_delta) > min_delta_direction_switch) {
178		if( scroll_delta > 0 ){ 
179			window_scroll.dir = 'up';           
180		} else {
181			window_scroll.dir = 'down';
182		}
183	}
184	prev_scroll_top = window_scroll.top;    
185	check_header_display(); 
186	raf_retrigger = true;
187
188	if(typeof logo_wiggler !== 'undefined') { logo_wiggler.logo_scroll_out_of_view(); }
189}
190var has_raf = true;
191var throttle_delay = 150;
192function start_scroll_throttle() {
193	if(typeof requestAnimationFrame === 'undefined') { has_raf = false; }
194	// console.log('has_raf: '+has_raf );
195	start_animation_frames();
196	
197	if(has_raf) {
198		// jQuery(window).scroll( jQuery.throttle( 50, scroll_functions ) );
199		const throttled = vanilla_throttle(do_scroll_function, throttle_delay);
200		window.addEventListener('scroll', throttled, { passive: true });
201	}   
202}
203function do_scroll_function() {
204	// page_is_scrolling = true;
205	if(raf_retrigger && has_raf) { requestAnimationFrame(start_animation_frames); } 
206}
207function vanilla_throttle(func, wait) {
208	let timer = null;
209	return function(...args) {
210		if (timer === null) {
211			timer = setTimeout(() => {
212				func.apply(this, args);
213				timer = null;
214			}, wait); 
215		}
216	};
217}
218var header_down = false;
219var header_down_y = 100;
220var logo_low_offset = 40;
221var logo_lower = logo_low_offset + 120;
222var hide_logo_down_y = 700;
223var max_logo_transform = -130;
224
225function check_header_display() {
226
227	doc_body.attr('data-scrolling', window_scroll.dir);
228	// if(!mobile_size()) {
229	if(
230		!header_down
231		&&
232		window_scroll.top > header_down_y
233		&&
234		window_scroll.dir == 'up'
235	) {
236		header_down = true; 
237		set_scrolling_dir(window_scroll.dir);
238	} else if(
239		header_down
240		&&
241		window_scroll.dir != 'up'
242	) {
243		header_down = false;
244		set_scrolling_dir(window_scroll.dir);
245	}
246	// Add the top already ?
247	if(window_scroll.top < header_down_y) {
248		doc_body.addClass('scrolled-to-top');
249	} else {
250		doc_body.removeClass('scrolled-to-top');
251	}
252	// Hide logo
253	if(window_scroll.top > hide_logo_down_y) {
254		doc_body.addClass('hide-logo');
255	} else {
256		doc_body.removeClass('hide-logo');
257	}
258	// Mini logo
259	if(window_scroll.top > logo_lower) {
260		doc_body.addClass('logo-small');
261	} else {
262		doc_body.removeClass('logo-small');
263	}
264
265	let logo_offset = (-1 * window_scroll.top);
266	if(logo_offset < max_logo_transform) { logo_offset = max_logo_transform;}
267	EL_logo.css('margin-top', logo_offset+'px');
268	
269}
270function set_scrolling_dir(direction) {
271	var cl_remove = 'scrolling-up';
272	var cl_add = 'scrolling-down';
273	if(direction == 'down') {
274		var cl_add = 'scrolling-up';
275		var cl_remove = 'scrolling-down';       
276	}
277	doc_body.attr('data-scrolling', window_scroll.dir);
278	doc_body.removeClass(cl_remove);
279	doc_body.addClass(cl_add);
280}
281
282var scroll_round_to_zero = 60;
283function window_scroll_to(pos_y, animation_length) {
284	if(typeof animation_length == 'undefined') { animation_length = 1000; }
285	// console.log('window_scroll_to in '+animation_length + 'ms');
286	// console.log(pos_y);
287	if(pos_y < scroll_round_to_zero) { pos_y = 0; }
288	$('html, body').animate({ scrollTop: pos_y }, animation_length, 'swing');	 // , 'easeInOutQuint'
289}
290/*                  __                   
291  ____ _____  _____/ /_  ____  __________
292 / __ `/ __ \/ ___/ __ \/ __ \/ ___/ ___/
293/ /_/ / / / / /__/ / / / /_/ / /  (__  ) 
294\__,_/_/ /_/\___/_/ /_/\____/_/  /___*/
295var header_offset = 0;
296function trigger_page_anchors() {
297	header_offset = EL_header.getSize().y;
298	// Trigger anchors
299	var in_page_as = $('a[href*="#"]:not(.toggle-more)');
300	in_page_as.each(function(i, el) {
301		var el = $(el);
302		var hash = el.prop('hash'); //.split('#')[1];
303		if(hash.indexOf('=') == -1) {
304			var rel_div = $(hash);
305			if(rel_div.length > 0) {
306				el.on('click', function(e){
307					window_scroll_to( rel_div.offset().top - header_offset );
308					return false;
309				})
310			}
311		}
312	})
313
314	// Home page ? Header Logo is back to top
315	if(doc_body.hasClass('home-page')) {
316		$('header a.logo').on('click', function(e) {
317			window_scroll_to(0);
318			e.preventDefault();
319		})
320	}
321
322	// Check for URL hashes #advanced-threat-detection-response
323	var accepted_loc_hashes = ['#tickets'];
324	var url_hash = location.hash;
325	// console.log(url_hash);
326	if(url_hash!=false && accepted_loc_hashes.indexOf(url_hash) != -1 ) {
327		var page_el = $( url_hash );
328		if(page_el.length > 0) { 
329			// wait a bittie..
330			var scroll_to_timer = setTimeout(function() {
331				window_scroll_to( (page_el.offset().top - header_offset), 0 );
332			}, 30);
333		}
334	}
335	let sresultstart = $('#sresultstart');	
336	if(sresultstart.length > 0) {
337		window_scroll_to( (sresultstart.offset().top - header_offset), 0 );
338	}
339}
340
341
342/*                 _          
343   ________  _____(_)___  ___ 
344  / ___/ _ \/ ___/ /_  / / _ \
345 / /  /  __(__  ) / / /_/  __/
346/_/   \___/____/_/ /___/\__*/
347/* Resize */
348function start_resize_throttle() {
349	const throttled_resize = vanilla_throttle(do_resize_function, throttle_delay);
350	window.addEventListener('resize', throttled_resize, { passive: true });
351	do_resize_function();
352}
353function do_resize_function() {
354	window_dims = {
355		width: window.outerWidth,
356		height: window.outerHeight,
357		header_h: EL_header.outerHeight()
358	}
359	if(window_dims.width < 800) {
360		max_logo_transform = -85;
361	}
362	cur_page_size = get_page_size();	
363	// console.log('do_resize_function');
364	set_css_vars();
365}
366
367/////////////////////////////////////////////////////////////////////
368/*  __    __           __       
369   / /_  / /___  _____/ /_______
370  / __ \/ / __ \/ ___/ //_/ ___/
371 / /_/ / / /_/ / /__/ ,< (__  ) 
372/_.___/_/\____/\___/_/|_/___*/
373/////////////////////////////////////////////////////////////////////
374var add_block_classes = function(options){
375	$ = jQuery;
376	var _o = {}; 
377	var _t = this;
378 
379	this.construct = function(options){
380		$.extend(_o , options);
381		_o.content_wraps = doc_body.find('section[id]');
382		_o.content_wraps.each(function(i, el) {
383			_o.content_wrap = $(el);
384			_t.check_first_content_type();
385			_t.add_col_classes();
386			_t.img_col_classes();
387		})
388	}
389	this.check_first_content_type = function() {
390		_o.first_div = _o.content_wrap.find('> *:first-child');
391		if(_o.first_div.length > 0) {
392			_o.el_classes = _o.first_div.get(0).classList;
393			// console.log(_o.el_classes)
394			if(
395				!_o.el_classes.contains('wp-block-cover')
396				&&
397				!_o.el_classes.contains('home-video')
398			) {
399				doc_body.addClass('no-img-header');
400			}
401		}		
402	}
403	this.add_col_classes = function() {
404		_o.col_wrappers = _o.content_wrap.find('.wp-block-columns');
405		if(_o.col_wrappers.length > 0) {
406			_t.class_col_wrappers();
407		}
408	}
409	this.class_col_wrappers = function() {
410		_o.col_wrappers.each(function(i, el){
411			var bl = $(el);
412			_o.col_wrap_class = [];
413			var ch = bl.children();
414			bl.addClass('cols-' + ch.length );
415			ch.each(function(i, chel){
416				var col_index = i + 1;
417				var chel = $(chel);
418				chel.addClass('col-'+col_index);
419				_t.col_cnt_type_class(chel);
420			})
421			bl.addClass( _o.col_wrap_class.join('-') );
422
423			_t.col_align_class(bl);
424		});
425	}
426	this.col_align_class = function(bl) {
427		var col_align_wide = (!bl.hasClass('alignwide') && !bl.hasClass('alignfull')) ? 'default' : '';
428		// console.log('col_align_wide? ',col_align_wide)
429		if(col_align_wide!='') { bl.addClass('align'+col_align_wide); }
430	}
431	this.img_col_classes = function() {
432		_o.img_wraps = doc_body.find('.wp-block-image');
433		_o.img_wraps.each(function(i, el){
434			var wrap = $(el);
435			var img_cap = wrap.find('figcaption');
436			if(img_cap.length > 0) {
437				wrap.addClass('has-caption');
438			}
439		})
440	}
441	this.col_cnt_type_class = function(chel) {
442		// Find the content type...
443		var first_child = chel.find('> *:first-child');
444		if(first_child.length > 0) {
445			var cnt_class = 'cnt-txt';
446			// p
447			if(first_child.hasClass('wp-block-image')) {
448				cnt_class = 'cnt-img';
449			} else if(first_child.hasClass('wp-block-gallery')) {
450				cnt_class = 'cnt-gal';
451			} else if(first_child.hasClass('wp-block-cover')) {
452				cnt_class = 'cnt-cover';
453			} else if(first_child.hasClass('wp-block-group')) {
454				cnt_class = 'cnt-group';
455			}
456			// wp-block-image
457			// gallery
458		} else {
459			var cnt_class = 'cnt-empty';
460		}
461		chel.addClass(cnt_class);
462		_o.col_wrap_class.push(cnt_class);
463		// console.log(first_child)
464
465	}
466	// Initiate
467	this.construct(options); 
468};
469/*           __                 __
470  ___  _  __/ /____  ____  ____/ /
471 / _ \| |/_/ __/ _ \/ __ \/ __  / 
472/  __/>
472  </ /_/  __/ / / / /_/ /  
473\___/_/|_|\__/\___/_/ /_/\__,*/
474jQuery.fn.extend({
475	getPosition: function(relative) {
476		if(relative===undefined) { relative = jQuery(document.body); } else { relative = jQuery(relative); }
477		var relative_x = jQuery(this).offset().left - relative.offset().left;     
478		var relative_y = jQuery(this).offset().top - relative.offset().top;     
479		var pos = {
480			'left' : relative_x,
481			'top' : relative_y
482		};
483		return pos;
484	},
485	getSize: function() {
486		var size_x = jQuery(this).outerWidth();     
487		var size_y = jQuery(this).outerHeight();     
488		var size = {
489			'x' : size_x,
490			'y' : size_y
491		};
492		return size;
493	},
494	getScroll: function() {
495		if(is_window(this)) {
496			var top  = window.pageYOffset;
497			var left = window.pageXOffset;
498		} else {
499			var top  = document.documentElement.scrollTop;
500			var left = document.documentElement.scrollLeft;	
501		}
502		var pos = {
503			'x' : left,
504			'y' : top
505		};
506		return pos;		    
507	},
508	getScrollSize: function() {
509		var x = jQuery(this).prop("scrollWidth");
510		var y = jQuery(this).prop("scrollHeight");
511		var pos = {
512			'x' : x,
513			'y' : y
514		};
515		return pos;		    
516	}
517	
518});
519function is_window(variable) {
520	return variable && variable.document && variable.location && variable.alert && variable.setInterval;	
521}
522
523
524function object_triggered(el) {
525	el = $(el);
526	if(el.data('triggered') === undefined) {
527		el.data('triggered', true);
528		return false;
529	} else {
530		return true;
531	}
532}
533function trigger_readmores() {
534	let more_links = $('div.read-more-wrapper');
535	if(more_links.length > 0) {
536		more_links.each(function(i, el){
537			let rml = new readmore_link({wrap: $(el)});
538		});
539	}
540
541}
542var readmore_link = function(options){
543	var _o = {
544		label_more: 'lees meer',
545		label_less: 'lees minder',
546	}; 
547	var _t = this;
548 
549	this.construct = function(options){
550		$.extend(_o , options);
551		_o.link = _o.wrap.find('a.toggle-more');
552
553		_o.rel_id = _o.link.attr('href');
554		_o.rel_div = $(_o.rel_id);
555		if(_o.rel_div.length > 0) {
556			_o.label_more = _o.link.html();
557			_o.label_less = _o.link.attr('data-less');
558			console.log(_o.label_less)
559			_o.wrap.addClass('toggle-ready');
560			_o.rel_div.addClass('toggle-more-content');
561			if(!_o.wrap.hasClass('opened')) {
562				_o.wrap.addClass('hiding-more');
563			}
564		}
565		_o.link.on('click', function(e){
566			let new_label = (_o.rel_div.hasClass('hidden')) ? _o.label_less : _o.label_more;
567			// _o.link.html(new_label)
568			_o.wrap.toggleClass('hiding-more');
569			_o.link.toggleClass('showing-rel');
570			e.preventDefault();
571		});
572	}
573	this.construct(options); 
574};
575
576
577function mm_get_rand_int(max) {
578  return Math.floor(Math.random() * max);
579}
580function mm_uniqid() {
581    var dtime = Date.now().toString(36);
582    return dtime;
583}
584
585/*                                  _          
586	____  ____ _____ ____     _____(_)___  ___ 
587   / __ \/ __ `/ __ `/ _ \   / ___/ /_  / / _ \
588  / /_/ / /_/ / /_/ /  __/  (__  ) / / /_/  __/
589 / .___/\__,_/\__, /\___/  /____/_/ /___/\___/ 
590/_/          /___*/
591
592function get_page_size(){
593
594	if(typeof EL_window == 'undefined') { EL_window = jQuery(window); }
595	if(typeof document_body == 'undefined') { document_body = jQuery(document.body); }
596
597	var scroll_position = EL_window.getScroll();
598	scroll_x = scroll_position.x;
599	scroll_y = EL_window.scrollTop();
600
601	// Total page content W & H
602	var body_size =	document_body.getScrollSize();
603	body_w = body_size.x;
604	body_h = body_size.y;
605	// Total window W & H
606	var window_size = EL_window.getSize();
607	window_w = window_size.x;
608	window_h = window_size.y;
609	
610	// For small pages with total height less then height of the viewport
611	if(body_h < window_h){
612		page_h = window_h;
613	} else {
614		page_h = body_h;
615	}
616
617	// For small pages with total width less then width of the viewport
618	if(scroll_x < window_w) {
619		page_w = window_w;
620	} else {
621		page_w = body_w;
622	}
623	var page_size_object ={};
624	page_size_object.page_w = page_w;
625	page_size_object.page_h = page_h;
626	page_size_object.scroll_x = scroll_x;
627	page_size_object.scroll_y = scroll_y;
628	page_size_object.scroll_size_x = body_size.x;
629	page_size_object.scroll_size_y = body_size.y;
630	page_size_object.window_w = window_w;
631	page_size_object.window_h = window_h;
632	return page_size_object;
633}
634
635
636function prev_next_index(cur_index, num_items, dir) {
637	new_index = 0;
638	// Prev
639	if(dir == 'prev') {
640		if( (cur_index - 1) >= 0) {
641			new_index = cur_index - 1;
642		} else {
643			new_index = num_items - 1;
644		}
645	}
646	// Next
647	if(dir == 'next') {
648		if(cur_index < (num_items - 1) ) {
649			new_index = cur_index + 1;
650		} else {
651			new_index = 0;
652		}
653	}
654	return new_index;
655}
656function move_in_page_els() {
657	var items_selector = [
658		'.wp-block-column', 
659		'.read-more-wrapper'
660	];
661	init_page_observer();
662	for (let item_selector of items_selector) {
663		$(item_selector).addClass('move-out');
664		console.log('move-out added');
665
666		var found_els = document.querySelectorAll(item_selector);
667		if(found_els!=null) {
668			found_els.forEach(found_el => page_observer.observe(found_el));	
669		}	
670	}	
671}
672/*       __                            
673  ____  / /_  ________  ______   _____ 
674 / __ \/ __ \/ ___/ _ \/ ___/ | / / _ \
675/ /_/ / /_/ (__  )  __/ /   | |/ /  __/
676\____/_.___/____/\___/_/    |___/\__*/
677
678var page_observer;
679var observe_treshold = 0.01;
680function init_page_observer() {
681	var op_root = (is_safari && mobile_size()) ? document.body : null;
682	let options = {
683		root: op_root,
684		rootMargin: "0px",
685		threshold: observe_treshold
686	};
687	page_observer = new IntersectionObserver(handle_page_objects_intersect, options);
688}
689function handle_page_objects_intersect(entries, page_observer) {
690	entries.forEach((entry) => {
691		fade_in_page_el(entry);
692	});
693}
694var video_els, page_observer;
695function scroll_n_load_vids() {	
696	// Set things up
697	video_els = document.querySelectorAll("div.video-wrapper");
698	if(video_els!=null) {
699		video_els.forEach(video_el => page_observer.observe(video_el));	
700	}
701}
702function fade_in_page_el(entry) {
703	// console.log(entry.target, entry.intersectionRatio);
704	if(entry.intersectionRatio > observe_treshold) {
705		page_observer.unobserve(entry.target);
706		let el = $(entry.target);
707		el.addClass('moved-in');
708		setTimeout(function(){
709			el.addClass('all-in');
710		}, 400);
711		// console.log( 'unobserved: ', entry.target)
712		// let vl = new video_loader({wrap:entry.target})
713	}
714}
715function trigger_bg_video() {
716	let vid_wrap = $('#bg-vid-wrap');
717	if(vid_wrap.length > 0) {
718		bgviddata = JSON.parse(bgviddata);
719		let vid_w_key = get_vid_w_key();
720		let vid_src = bgviddata[ vid_w_key ];// (mobile_size()) ? bgviddata['src_mobile'] : bgviddata['src_hd'];
721		console.log(vid_w_key, vid_src)
722		// vid_wrap
723		let vid_html = `<video muted loop autoplay playsinline>
724			<source src="`+vid_src+`" type="video/mp4" />
725		</video>`;
726		vid_wrap.append(vid_html);
727	}
728}
729function get_vid_w_key(data) {
730	var window_w_keys = {
731		0: { w: 2000, key: 'src_4k' },
732		1: { w: 1920, key: 'src_full_hd' },
733		2: { w: 1280, key: 'src_hd' },
734		3: { w: 800, key: 'src_mobile' },
735	}
736	let window_w = cur_page_size.window_w;
737
738	let prev_vid_key = vid_key = '';
739	for( vid_i in window_w_keys) {
740		let vid_data = window_w_keys[vid_i];
741		let vid_w = vid_data['w'];
742		vid_key = vid_data['key'];
743		if(window_w > vid_w) {
744			return (prev_vid_key!='') ? prev_vid_key : vid_key;
745		}
746		prev_vid_key = vid_key;
747	}
748	return vid_key;
749}
750/* ____ ___  ____ _____ 
751  / __ `__ \/ __ `/ __ \
752 / / / / / / /_/ / /_/ /
753/_/ /_/ /_/\__,_/ .___/ 
754               /*/
755var bg_map_styled;
756var bg_map_style = [{"elementType": "geometry","stylers": [{"color": "#232323"}]},{"elementType": "labels.icon","stylers": [{"color": "#aa7942"},{"visibility": "on"}]},{"elementType": "labels.text.fill","stylers": [{"color": "#ffffff"},{"visibility": "off"}]},{"featureType": "landscape.man_made","stylers": [{"visibility": "off"}]},{"featureType": "poi","elementType": "labels.text.fill","stylers": [{"color": "#ffffff"},{"visibility": "on"}]},{"featureType": "poi","elementType": "labels.text.stroke","stylers": [{"color": "#000000"}]},{"featureType": "poi.attraction","stylers": [{"visibility": "off"}]},{"featureType": "poi.attraction","elementType": "geometry.fill","stylers": [{"visibility": "off"}]},{"featureType": "poi.attraction","elementType": "labels.icon","stylers": [{"visibility": "on"}]},{"featureType": "poi.attraction","elementType": "labels.text","stylers": [{"visibility": "off"}]},{"featureType": "poi.attraction","elementType": "labels.text.fill","stylers": [{"visibility": "off"}]},{"featureType": "poi.attraction","elementType": "labels.text.stroke","stylers": [{"visibility": "off"}]},{"featureType": "poi.business","elementType": "labels.icon","stylers": [{"color": "#a96800"}]},{"featureType": "poi.business","elementType": "labels.text","stylers": [{"color": "#785700"},{"visibility": "simplified"}]},{"featureType": "poi.business","elementType": "labels.text.fill","stylers": [{"color": "#a96800"},{"visibility": "off"}]},{"featureType": "road","elementType": "geometry","stylers": [{"color": "#38414e"}]},{"featureType": "road","elementType": "geometry.stroke","stylers": [{"visibility": "on"},{"weight": 1}]},{"featureType": "road.arterial","elementType": "labels.text","stylers": [{"visibility": "off"}]},{"featureType": "road.local","stylers": [{"color": "#d29d00"},{"weight": 1.5}]},{"featureType": "road.local","elementType": "labels.text","stylers": [{"color": "#000000"}]},{"featureType": "road.local","elementType": "labels.text.fill","stylers": [{"color": "#ffffff"},{"visibility": "on"}
756]},{"featureType": "water","elementType": "geometry","stylers": [{"color": "#17263c"}]},{"featureType": "water","elementType": "geometry.fill","stylers": [{"color": "#00364a"}]},{"featureType": "water","elementType": "labels.text.fill","stylers": [{"color": "#515c6d"}]},{"featureType": "water","elementType": "labels.text.stroke","stylers": [{"color": "#17263c"}]}];
757
758function trigger_google_maps() {
759	var gmaps = $('.google-map');
760	gmaps.each(function(i, e){
761		var gmap = new mm_gmap({el: $(e)})
762	})
763}
764function enable_gmap() {
765	console.log('enable_gmap')
766}
767var gmap_js_loaded,google_api_key;
768var mm_gmap = function(options){
769	/* Variables accessible in the class */
770	var _o = {
771		el: null,
772		default_zoom: 17
773	}; 
774	/* Can access this.method inside other methods using _t.method() */
775	var _t = this;
776 
777	/* Constructor - Pass options when class instantiated */
778	this.construct = function(options){
779		$.extend(_o , options);
780		// console.log(_o.el);
781		_o.coords = _o.el.attr('data-coords').split(',');
782		google_api_key = _o.el.attr('data-gmapkey')
783		// console.log(_o.coords);
784		_t.set_el_id();
785		_t.load_gmap_js();
786	}
787	this.set_el_id = function() {
788		_o.map_el_ID = _o.el.attr('id');
789		if(_o.map_el_ID == undefined) {
790			_o.map_el_ID = 'g-map-'+ Math.random( 1 );
791			_o.map_el_ID = _o.map_el_ID.replace('.', '-');
792			_o.el.attr('id', _o.map_el_ID);
793		}
794	}
795	this.load_gmap_js = function() {
796		// Load the JS ?
797		if(!gmap_js_loaded) {
798			// console.log(google_api_key);
799			var url = 'https://maps.google.com/maps/api/js?key='+google_api_key+'&callback=enable_gmap';
800			$.getScript( url, function() {
801				gmap_js_loaded = true;
802				_t.build_gmap();
803			});
804		} else {
805			_t.build_gmap();
806		}
807	}
808	this.build_gmap = function() {
809		console.log("build_gmap");
810		// Set point
811		var point = new google.maps.LatLng(_o.coords[0],_o.coords[1] );
812		// Map options object
813		var myMapOptions = {
814			zoom: _o.default_zoom,
815			scrollwheel: false,
816			mapTypeControl: false,
817			disableDefaultUI: true,
818			center: point,
819			mapTypeId: 'satellite'
820		};
821		// activate map
822		_o.map = new google.maps.Map(document.getElementById(_o.map_el_ID), myMapOptions);
823
824		bg_map_styled = new google.maps.StyledMapType(bg_map_style, {name: "Styled Map"} );
825		// Add style
826		_o.map.mapTypes.set('map_style', bg_map_styled);
827		_o.map.setMapTypeId('map_style');
828
829
830	  // Marker sizes are expressed as a Size of X,Y where the origin of the image
831	  // (0,0) is located in the top left of the image.
832
833	  // Origins, anchor positions and coordinates of the marker increase in the X
834	  // direction to the right and in the Y direction down.
835		const img_path = mm_ajax.mm_theme_url + '/_img/map-marker.png';
836		const image = {
837			url: img_path,
838			// This marker is 20 pixels wide by 32 pixels high.
839			size: new google.maps.Size(68, 90),
840			// The origin for this image is (0, 0).
841			origin: new google.maps.Point(0, 0),
842			// The anchor for this image is the base of the flagpole at (0, 32).
843			anchor: new google.maps.Point(34, 90),
844		};
845
846		// Place marker
847		var map_marker = new google.maps.Marker({
848			position: point, 
849			map: _o.map, 
850			icon: image
851			// draggable:true
852		});	
853
854		google.maps.event.addListener(map_marker, 'click', function() {
855		    // window.open( 'https://goo.gl/maps/FD2CDS6m2UcjpH3i9' );
856		});		
857		// 
858	}
859
860	// Initiate
861	this.construct(options); 
862};
863/*
864  ____ _  (_)___ __  __
865 / __ `/ / / __ `/ |/_/
866/ /_/ / / / /_/ />  <  
867\__,_/_/ /\__,_/_/|_|  
868	/__*/
869function ajax_btns() {
870	$ = jQuery;
871	// Ajaxify #contactformulier
872	ajaxify_contact_form_links();
873	// Trigger buttosn
874	var ajax_btns = $('a[data-load]');
875	ajax_btns.off('click');
876	ajax_btns.each(function(i, el){
877		var ab = new ajax_buttoner({link: $(el)})
878	})
879}
880function ajaxify_contact_form_links() {
881	let cfbtns = $('a[href^="#contactformulier"]');
882	if(cfbtns.length > 0) {
883		cfbtns.each(function(i, cfbtn){
884			cfbtn = $(cfbtn);
885			cfbtn.attr('data-load', 'contact_form');
886			cfbtn.attr('data-cpt', 'wpcf7');
887			cfbtn.attr('data-id', '1');
888		})
889	}
890}
891var ajax_buttoner = function(options){
892	var _o = {
893		link: null,
894		append_cpts: ['artist'],
895		cpts_event: ['expo', 'activity']
896	}; 
897	var _t = this;
898 
899	this.construct = function(options){
900		$.extend(_o , options);
901		_o.loading = false;
902		_o.link.on('click', function(e){
903			_t.trigger_btn();
904			e.preventDefault();
905		});
906	}
907	this.trigger_btn = function() {
908		// Get data
909		_o.btn_data = {
910			action: "load_mm_ajax_data", 
911			call: _o.link.attr('data-load'),
912			cpt: _o.link.attr('data-cpt'),
913			id: parseInt( _o.link.attr('data-id') ),
914		}
915		if(!_o.link.hasClass('data-loaded')) {
916			_t.get_ajax_data( _o.btn_data );
917		} else {
918			_o.link.parents('div.news-item').toggleClass('hide-focus');
919		}
920	}
921	this.get_ajax_data = function( ajax_data ) {
922		if(!_o.loading) {
923			_t.loading_start();
924			// console.log(ajax_data);
925			$.ajax({
926				type : "post",
927				dataType : "json",
928				url : mm_ajax.mm_ajaxurl,
929				data : ajax_data,
930				success: function(response) {
931					console.log('done', response)
932					_t.parse_ajax_response(response);
933				},
934				fail: function(xhr, status, text) {
935					_t.loading_done();
936					console.log(xhr);
937				}
938			});
939		}
940	}
941	this.parse_ajax_response = function( response_data ) {
942		_t.loading_done();
943		_o.response_data = response_data;
944		_o.link.addClass('data-loaded');
945		if(_o.btn_data.cpt != 'wpcf7') {
946			doc_body.find('a[data-cpt="'+_o.btn_data.cpt+'"][data-id="'+_o.btn_data.id+'"][data-load="'+_o.btn_data.call+'"]').addClass('data-loaded')
947		}
948		// console.log(_o.response_data);
949		switch( _o.response_data['return'] ) {
950			case 'load_tm_dates':
951				_t.insert_tm_dates();
952			  break;
953			case 'item_focus':
954				_t.insert_item_focus();
955			  break;
956			case 'contact_form':
957				_t.insert_contact_form();
958			  break;
959		}
960	}
961	this.loading_start = function() {
962		_o.link.addClass('loading');
963		_o.link.append( $('<i class="loader"></i>' ) );
964		_o.loading = true;
965	}
966	this.loading_done = function() {
967		_o.link.removeClass('loading');
968		_o.link.find('i.loader').remove();
969		_o.loading = false;
970	}
971	// Insert dates
972	this.insert_tm_dates = function() {
973		// _t.get_link_par();
974		var event_id = _o.response_data['data']['production'];
975		_o.link_par = $('#circle-event-' + event_id);
976		_o.focus_placement = 'append';
977		_t.place_data_in_par();
978	}
979
980	// Insert item focus
981	this.insert_item_focus = function() {
982		// console.log(_o.response_data)
983		var item_id = _o.response_data['data']['item_focus'];
984		let item_cpt = _o.link.attr('data-cpt');
985		if(item_cpt == 'post') {
986			let item_id = parseInt( _o.link.attr('data-id') );
987			let item_focus_div = 'item-focus-' + item_id;
988			_o.ajax_html = $(_o.response_data['data']['html']);
989			_o.focus_wrap = $('#' + item_focus_div).append();
990			_o.focus_wrap.append( _o.ajax_html );
991			_o.news_item_par = _o.link.parents('div.news-item');
992			_o.news_item_par.addClass('data-loaded');
993			// Toggle all ajax-lnks for same item
994			let all_item_ajax_links = $('a[data-load="item_focus"][data-cpt="post"][data-id="'+item_id+'"]');
995			console.log('all_item_ajax_links', all_item_ajax_links, item_id)
996			all_item_ajax_links.addClass('data-loaded');
997			// Add closer
998			_o.focus_wrap.append( $('<a class="focus-closer">&lsaquo;&lsaquo;&lsaquo; lees minder</a>') );
999			setTimeout(function(e){
1000				_o.focus_wrap.find('a.focus-closer').on('click', function(e){
1001					_o.news_item_par.toggleClass('hide-focus');
1002					e.preventDefault();
1003				})
1004			}, 100)
1005		} else {
1006
1007			let item_id_prefix = (_o.cpts_event.indexOf(item_cpt) == -1) ? 'item-' : 'dcd-event-';
1008			_o.link_par_id = item_id_prefix + item_id;
1009			_o.link_par = _o.link.parent();// $('#' + _o.link_par_id); // dcd-event-239
1010			_o.focus_placement = (_o.append_cpts.indexOf(item_cpt) != -1) ? 'append' : 'after';
1011			// console.log('_o.focus_placement', _o.focus_placement)
1012			// Event in events overview...? Find the 3nth child to place the ajax-content
1013			if( _o.cpts_event.indexOf(item_cpt)!= -1) {
1014				_t.get_event_data_placement();
1015			}
1016			_t.place_data_in_par();
1017		}
1018	}
1019	this.insert_contact_form = function() {
1020		doc_body.append( $(_o.response_data['html'])  );
1021		doc_body.addClass('modal-active');
1022		_o.link.removeClass('data-loaded'); // is not a toggler link
1023
1024		// Activate closer
1025		setTimeout(function(){
1026			let modal = doc_body.find('.page-modal');
1027			var wpcp7_form  = jQuery('.wpcf7-form');
1028			wpcf7.init( wpcp7_form.get(0) );
1029
1030			modal.find('a.closer').on('click', function(e){
1031				modal.remove();
1032				doc_body.removeClass('modal-active');
1033				e.preventDefault();
1034			})
1035		}, 100)
1036	}
1037	this.get_event_data_placement = function() {
1038		_o.wrapper = _o.link_par.parent();
1039		let link_par_type = _o.link_par.get(0).tagName.toLowerCase();
1040		let wrap_children = _o.wrapper.find('> '+link_par_type);
1041		let num_children = wrap_children.length;
1042		wrap_children.each(function(i, el){
1043			let cur_el = $(el);
1044			if(cur_el.get(0).id == _o.link_par_id) {
1045				el_i = i + 1;
1046			}
1047		});
1048		let per_row = 3; // if mobile change
1049		let leftover = Math.ceil(el_i / per_row);
1050		let append_index = leftover * per_row;
1051		if(append_index >= num_children) { append_index = num_children; }
1052		append_index--;
1053		_o.link_par = $( wrap_children.get(append_index) );
1054		_o.focus_placement = 'after';
1055		// Close other focus content
1056		_t.close_other_focus_content();
1057	}
1058	this.close_other_focus_content = function() {
1059		_o.cur_focus_els = 	_o.wrapper.find('.focus-content');
1060		if(_o.cur_focus_els.length > 0) {
1061			console.log(_o.cur_focus_els)
1062			_o.cur_focus_els.each(function(i, el){
1063				let cur_el = $(el);
1064				let el_id = cur_el.attr('id');
1065				let el_par_link_id = el_id.replace('-focus-', '-');
1066				$('#'+el_par_link_id).addClass('hide-loaded-data');
1067				cur_el.addClass('hide-focus');
1068				// dcd-event-focus-57
1069				// $(el).find('a.closer').trigger('click');
1070			})
1071		}
1072
1073	}
1074	// items-wrapper // items-overview
1075
1076
1077	this.place_data_in_par = function() {
1078		// let ajax_element = '<div class="loaded-data-wrap">' +  + '</div>';
1079		_o.ajax_html = $(_o.response_data['data']['html']);
1080		switch(_o.focus_placement) {
1081			case 'after':
1082				_o.link_par.after( _o.ajax_html );
1083			  break;
1084			case 'append':
1085			default:
1086				_o.link_par.append( _o.ajax_html );
1087			  break;
1088		}
1089		// console.log(_o.focus_placement, _o.link_par)
1090		if(
1091			_o.focus_placement == 'after' 
1092			|| 
1093			(_o.append_cpts.indexOf(_o.link.attr('data-cpt') ) != -1)
1094		) {
1095			_t.insert_closer();
1096		}
1097		_o.link_par.addClass('data-placed');
1098		// Scroll to it
1099
1100		window_scroll_to( $(_o.ajax_html).offset().top - header_offset );
1101		on_page_update();
1102	}
1103	this.toggle_loaded_data = function() {
1104		if(_o.link_par.hasClass('data-placed')) {
1105			if(_o.focus_placement == 'append') {
1106				_o.placed_data_wrap = _o.link_par.find('.loaded-data');
1107			} else {
1108				_o.placed_data_wrap = _o.link_par.next('.loaded-data');
1109			}
1110			// console.log('_o.placed_data_wrap: ',_o.placed_data_wrap)
1111			if(_o.placed_data_wrap.css('display') != 'none' ) {
1112				_o.link_par.addClass('hide-loaded-data');
1113				_o.ajax_html.addClass('hide-focus');
1114			} else {
1115				_o.link_par.removeClass('hide-loaded-data');
1116				_o.ajax_html.removeClass('hide-focus');
1117			}
1118			window_scroll_to( $(_o.link_par).offset().top - header_offset);
1119		}
1120	}
1121	this.insert_closer = function() {
1122		_o.ajax_html.append( $('<a class="closer">&times;</a>') );
1123		_o.close_btn = _o.ajax_html.find('a.closer');
1124		_o.close_btn.on('click', function(e){
1125			_t.toggle_loaded_data();
1126		});
1127
1128	}
1129	this.construct(options); 
1130};

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.