PageSourceSearch

https://www.lifb.org/wp-content/plugins/bold-page-builder/content_…/js/content_elements.js?ver=5.0.1

js lifb.org collected 2026-09-24 11:59:41 UTC 33,799 bytes, 1,070 lines download raw bytes

1(function( $ ) { 
2	"use strict";
3	// animations
4	window.bt_bb_animate_elements = function() {
5		var $elems = $( '.animate:not(.animated)' );
6		$elems.each( function() {
7			var $elm = $(this);
8			if ( isOnScreen( $elm ) ) {
9				$elm.addClass( 'animated' );
10				if ( $elm.hasClass( 'bt_bb_counter' ) ) {
11					bt_bb_animate_counter( $elm );
12				}
13				if (typeof window.local_bt_bb_animate_elements == 'function') { 
14				  local_bt_bb_animate_elements( $elm ); 
15				}
16			}
17		});
18		bt_bb_lazy_load_images();
19		$( '.slick-slider .slick-slide:not(.slick-active) .animate' ).removeClass( 'animated' );
20	}
21	
22	// lazy image load
23	window.bt_bb_lazy_load_images = function() {
24		var $elems = $( 'img.btLazyLoadImage:not(.btLazyLoaded)' );
25		$elems.each(function() {
26			var $elm = $(this);
27			if ( isOnScreen( $elm, -200 ) ) {
28				$elm.addClass( 'btLazyLoaded' );
29				$elm.attr( 'src', $elm.data( 'image_src' ));
30			}
31		});
32		var $elems = $( 'image.btLazyLoadImage:not(.btLazyLoaded)' );
33		$elems.each(function() {
34			var $elm = $(this);
35			if ( isOnScreen( $elm, -200 ) ) {
36				$elm.addClass( 'btLazyLoaded' );
37				$elm.attr( 'xlink:href', $elm.data( 'image_src' ));
38			}
39		});
40		var $elems = $( '.btLazyLoadBackground:not(.btLazyLoaded)' );
41		$elems.each(function() {
42			var $elm = $(this);
43			if ( isOnScreen( $elm, -200 ) ) {
44				$elm.addClass( 'btLazyLoaded' );
45				$elm.css( 'background-image', 'url(' + $elm.data( 'background_image_src' ) + ')' );
46			}
47		});
48	}
49	
50	// css image grid lighbox
51	
52	window.bt_bb_init_css_image_grid_lightbox = function() {
53		$( '.bt_bb_css_image_grid' ).not( '.bt_bb_no_lightbox' ).each(function() {
54			$( this ).magnificPopup({
55				delegate: '.bt_bb_css_image_grid_item',
56				type: 'image',
57				gallery:{
58					enabled: true
59				},
60				callbacks: {
61					elementParse: function( item ) { item.src = item.el.data( 'src-full' ); }
62				},
63				closeBtnInside: false,
64				fixedContentPos: false
65			});
66		});		
67	}
68	
69	// tabs
70	
71	window.bt_bb_init_tabs = function() {
72		$( '.bt_bb_tabs' ).not( '.bt_bb__inited' ).each(function() {
73			$( this ).addClass( 'bt_bb__inited' );
74			$( this ).find( '.bt_bb_tabs_header' ).on( 'click', 'li', function() {
75				$( this ).siblings().removeClass( 'on' );
76				$( this ).addClass( 'on' );
77				$( this ).closest( '.bt_bb_tabs' ).children('.bt_bb_tabs_tabs').children( '.bt_bb_tab_item' ).removeClass( 'on' );
78				$( this ).closest( '.bt_bb_tabs' ).children('.bt_bb_tabs_tabs').children( '.bt_bb_tab_item' ).eq( $( this ).index() ).addClass( 'on' );
79			});
80			$( this ).find( 'li' ).first().trigger( 'click' );
81		});	
82	}
83	
84	// isOnScreen fixed
85	
86	function iOSversion() {
87	  if (/iP(hone|od|ad)/.test(navigator.platform)) {
88		// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
89		var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
90		return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
91	  } else {
92		  return false;
93	  }
94	}
95
96	var ver = iOSversion();
97	
98	// isOnScreen
99	
100	function isOnScreen( elem, top_offset ) {
101		if ( ver && ver[0] == 13 ) return true;
102		top_offset = ( top_offset === undefined ) ? 75 : top_offset;
103		var element = elem.get( 0 );
104		if ( element == undefined ) return false;
105		var bounds = element.getBoundingClientRect();
106		var output = bounds.top + top_offset < window.innerHeight && bounds.bottom > 0;
107		// alert(output);
108		return output;
109	}
110
111	// animate counter
112	
113	function bt_bb_animate_counter( $elm ) {
114		var number_length = $elm.data( 'digit-length' );
115		for ( var i = parseInt( number_length ); i > 0; i-- ) {
116			var digit = parseInt( $elm.children( '.p' + i ).data( 'digit' ) );
117			if ( digit == 0 ) digit = 10;
118			if ( isNaN( digit ) ) digit = 10;
119			for ( var j = 0; j <= digit; j++ ) {
120				$elm.children( '.p' + i ).css( 'transform', 'translateY(-' + digit * $elm.outerHeight() + 'px)' );
121			}
122			$elm.addClass( 'animated' );
123		}
124		
125		return false;
126	}
127	
128	// paralax helpers 
129	
130	window.bt_bb_requestAnimFrame = function() {
131		return (
132			window.requestAnimationFrame       ||
133			window.webkitRequestAnimationFrame ||
134			window.mozRequestAnimationFrame    ||
135			window.oRequestAnimationFrame      ||
136			window.msRequestAnimationFrame     ||
137			function( callback ) {
138				window.setTimeout( callback, 1000 / 60 );
139			}
140		);
141	}();
142	
143	function bt_clamp_number ( val, min, max ) {
144		return val > max ? max : val < min ? min : val;
145	}
146	
147	var is_edge = navigator.userAgent.indexOf( 'Edge' ) > -1;
148	var is_chrome = navigator.userAgent.indexOf( 'Chrome' ) > -1;
149	var is_safari = navigator.userAgent.indexOf( 'Safari' ) > -1;
150	var is_firefox = navigator.userAgent.indexOf( 'Firefox' ) > -1;
151	if ( is_chrome && is_safari ) window.is_safari = false;
152	var chrome_version = false;
153	// alert( navigator.userAgent );
154	// if ( is_chrome ) chrome_version = /Chrome\/([0-9]+)/.exec(navigator.userAgent)[1];
155
156	window.bt_bb_raf_loop = function() {
157		var win_w = window.innerWidth;
158		var win_h = window.innerHeight;
159		const SPEED_DELTA = 0.0001;
160		
161		$( 'html.bt_bb_backgroud_fixed_supported .bt_bb_parallax' ).each(function() {
162			if ( $( 'html' ).attr( 'data-bt_bb_screen_resolution' ) !== 'xxl' && $( 'html' ).attr( 'data-bt_bb_screen_resolution' ) !== 'xl' ) {
163				$( this )[0].style.backgroundPosition = 'center center';
164				return false;
165			} else {
166				var bounds = $( this ).hasClass( 'bt_bb_background_image_holder' ) ? this.parentElement.getBoundingClientRect() : this.getBoundingClientRect();
167
168				if ( bounds.top < win_h && bounds.bottom > 0 ) {
169					var speed = parseFloat( $( this ).attr( 'data-parallax' ) ) + SPEED_DELTA;
170					if ( speed == 2 + SPEED_DELTA ) {
171					// if ( false ) {
172						// skip parallax, use fixed background
173						$( this )[0].style.backgroundAttachment = 'fixed';	
174					} else {
175						
176						var offset = parseFloat( $( this ).attr( 'data-parallax-offset' ) );
177						var ypos = offset - bounds.top * speed / 2;
178						ypos = ( ypos > -0.5 && ypos < 0.5 ) ? 0 : ypos;
179						
180						$( this )[0].style.backgroundPositionY = ypos + 'px';						
181					}
182					
183					// temp if, to support old sections
184					if ( $( this ).hasClass( 'bt_bb_background_image_holder' ) ) {
185						
186						var bounds_mid = ( bounds.top + bounds.bottom ) / 2;
187						var scroll_distance = ( bounds_mid - win_h / 2 ) / ( win_h ) ;
188						scroll_distance = bt_clamp_number ( scroll_distance, 0, 1 );
189					
190						var ZOOM_START = parseFloat( $( this ).attr( 'data-parallax-zoom-start' ) );
191						var ZOOM_END = parseFloat( $( this ).attr( 'data-parallax-zoom-end' ) );
192						
193						if ( ZOOM_START >= 1 && ZOOM_END >= 1 && ( ZOOM_START != 1 || ZOOM_END != 1 )  ) {
194							var zoom = ZOOM_START + ( ZOOM_END - ZOOM_START ) * ( 1 - scroll_distance );
195							$( this )[0].style.transform = ' scale(' + zoom + ')';								
196						}							
197						
198						var BLUR_START = parseFloat( $( this ).attr( 'data-parallax-blur-start' ) );
199						var BLUR_END = parseFloat( $( this ).attr( 'data-parallax-blur-end' ) );
200						
201						if ( BLUR_START >= 0 && BLUR_END >= 0 && ( BLUR_START != 0 || BLUR_END != 0 ) ) {
202							var blur = BLUR_START + ( BLUR_END - BLUR_START ) * ( 1 - scroll_distance );
203							$( this )[0].style.filter = ' blur(' + blur + 'px)';								
204						}							
205						
206						var OPACITY_START = parseFloat( $( this ).attr( 'data-parallax-opacity-start' ) );
207						var OPACITY_END = parseFloat( $( this ).attr( 'data-parallax-opacity-end' ) );
208						
209						if ( OPACITY_START >= 0 && OPACITY_END >= 0 && ( OPACITY_START != 1 || OPACITY_END != 1 ) ) {
210							var opacity = OPACITY_START + ( OPACITY_END - OPACITY_START ) * ( 1 - scroll_distance );
211							$( this )[0].style.opacity = opacity;								
212						}
213					}
214				}				
215			}
216		});
217		window.bt_bb_raf_lock = false;
218	}
219	
220	// touch screen detect
221	
222	window.bt_detect_touch = function() {
223	  if (typeof window !== 'undefined') {
224		var bt_has_touch = Boolean(
225		  'ontouchstart' in window ||
226		  window.navigator.maxTouchPoints > 0 ||
227		  window.navigator.msMaxTouchPoints > 0 ||
228		  window.DocumentTouch && document instanceof DocumentTouch
229		);
230		if ( bt_has_touch ) $('html').addClass( 'bt_bb_touch' );
231		// Mobile device detection
232		if ( /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) )  {
233			$('html').addClass( 'bt_bb_mobile' );
234		}
235	  }
236	}
237	
238	// screen detect
239	
240	window.bt_bb_get_screen_resolution = function() {
241		var width = Math.max( document.documentElement.clientWidth, window.innerWidth || 0 );
242		var res = 'xxl';
243		if (width <= 1400) res = 'xl';
244		if (width <= 1200) res = 'lg';
245		if (width <= 992) res = 'md';
246		if (width <= 768) res = 'sm';
247		if (width <= 480) res = 'xs';
248		
249		$( 'html' ).attr( 'data-bt_bb_screen_resolution', res );
250		
251		$( '[data-bt-override-class]' ).each(function() {
252			var override_classes = $( this ).data( 'bt-override-class' );
253			for ( var prefix in override_classes ) {
254				if ( override_classes[ prefix ][ res ] !== undefined ) {
255					var new_class = prefix + override_classes[ prefix ][ res ];
256				} else {
257					var new_class = prefix + override_classes[ prefix ][ 'xxl' ];
258				}
259				$( this ).removeClass( override_classes[ prefix ][ 'current_class' ] );
260				$( this ).addClass( new_class );
261				override_classes[ prefix ][ 'current_class' ] = new_class;
262				$( this ).data( 'override_classes', override_classes );
263			};
264
265		});
266		
267	}
268
269
270	
271	// Test fixed background support for iOS devices
272	
273	window.bt_bb_check_ios_fixed_background_support = function() {
274		return ( /iPad|iPhone|iPod/.test(navigator.userAgent) && ! window.MSStream ) ||
275			   ( /MacIntel/.test(navigator.platform) && $('html').hasClass( 'bt_bb_touch' ) );
276			   
277			   /* /MacIntel/... <- checks iPadPro */
278	}
279	
280	// Test fixed background support
281	
282	window.bt_bb_check_fixed_background = function() {
283		var el = document.createElement('div');
284		try {
285			if ( ! ( 'backgroundAttachment' in el.style ) || bt_bb_check_ios_fixed_background_support() ) {
286				$( 'html' ).removeClass( 'bt_bb_backgroud_fixed_supported' );
287				return false;
288			}
289			el.style.backgroundAttachment = 'fixed';
290			if ( ( 'fixed' === el.style.backgroundAttachment ) ) {
291				$( 'html' ).addClass( 'bt_bb_backgroud_fixed_supported' );
292				return true;			
293			}
294		}
295		catch (e) {
296			$( 'html' ).removeClass( 'bt_bb_backgroud_fixed_supported' );
297			return false;
298		}
299	}
300	
301	// Countdown timer helpers
302	
303	window.bt_bb_countdown = function( elem, selector, i, arr, arr_prev ) {
304		
305		if ( arr[ i ] !== arr_prev[ i ] || elem.find( selector ).children().eq( 0 ).html() == '' ) {
306			elem.find( selector ).children().addClass( 'countdown_anim' );
307			elem.find( selector ).children().eq( 0 ).html( arr[ i ] );
308			elem.find( selector ).children().eq( 1 ).html( arr_prev[ i ] );
309			setTimeout(function() {
310				elem.find( selector ).children().eq( 1 ).html( elem.find( selector ).children().eq( 0 ).html() );
311				elem.find( selector ).children().removeClass( 'countdown_anim' );
312			}, 300 );
313		}
314	}
315	
316	window.bt_bb_countdown_output = function( elem ) {
317		
318		var s = elem.attr( 'data-init-seconds' );
319		if ( isNaN( s ) ) {
320			s = 0;
321		}
322		var delta = s;
323		
324		var days = Math.floor( delta / 86400 );
325		delta -= days * 86400;
326
327		var hours = Math.floor( delta / 3600 ) % 24;
328		delta -= hours * 3600;
329
330		var minutes = Math.floor( delta / 60 ) % 60;
331		delta -= minutes * 60;
332
333		var seconds = delta;
334		
335		if ( hours < 10 ) {
336			hours = '0' + hours;
337		}
338		
339		if ( minutes < 10 ) {
340			minutes = '0' + minutes;
341		}
342
343		if ( seconds < 10 ) {
344			seconds = '0' + seconds;
345		}
346
347		var seconds_arr_prev = seconds.toString().split( '' );
348		var minutes_arr_prev = minutes.toString().split( '' );
349		var hours_arr_prev = hours.toString().split( '' );		
350		
351		s = s - 1;
352		if ( s < 0 ) {
353			s = 0;
354		}
355		
356		var delta = s;
357		
358		var days = Math.floor( delta / 86400 );
359		delta -= days * 86400;
360
361		var hours = Math.floor( delta / 3600 ) % 24;
362		delta -= hours * 3600;
363
364		var minutes = Math.floor( delta / 60 ) % 60;
365		delta -= minutes * 60;
366
367		var seconds = delta;
368		
369		if ( hours < 10 ) {
370			hours = '0' + hours;
371		}
372		
373		if ( minutes < 10 ) {
374			minutes = '0' + minutes;
375		}
376
377		if ( seconds < 10 ) {
378			seconds = '0' + seconds;
379		}
380		
381		var seconds_arr = seconds.toString().split( '' );
382		var minutes_arr = minutes.toString().split( '' );
383		var hours_arr = hours.toString().split( '' );
384
385		for ( var i = 0; i <= 1; i++ ) {
386			bt_bb_countdown( elem, '.seconds .n' + i, i, seconds_arr, seconds_arr_prev );
387			bt_bb_countdown( elem, '.minutes .n' + i, i, minutes_arr, minutes_arr_prev );
388			bt_bb_countdown( elem, '.hours .n' + i, i, hours_arr, hours_arr_prev );
389		}
390		
391		var days_arr = days.toString().split( '' );
392		
393		var days_html = '';
394		for ( var i = 0; i < days_arr.length; i++ ) {
395			days_html += '<span>' + days_arr[ i ] + '</span>';
396		}
397
398		elem.find( '.days' ).html( days_html + '<span class="days_text"><span>' + elem.find( '.days' ).data( 'text' ) + '</span></span>' );
399
400		elem.attr( 'data-init-seconds', s );
401
402	}
403	
404	function bt_bb_fix_slider_heights(){
405		$( '.bt_bb_content_slider.bt_bb_height_keep-height .slick-slider' ).each(function( index ) {
406			$( this ).find('.slick-slide').height('auto');
407			var slickTrack = $( this ).find('.slick-track');
408			var slickTrackHeight = $(slickTrack).height();
409			$( this ).find('.slick-slide').css('height', slickTrackHeight + 'px');
410		});
411	}
412
413	function bt_bb_init_elements() {
414		
415		// get row structure
416		
417		$( '.bt_bb_section .bt_bb_row' ).each( function( index ) {
418			var data_structure = [];
419			$( this ).data( 'structure', "0" );
420			$( this ).find('.bt_bb_column').each( function( index ) {
421				data_structure.push( $( this ).data( 'width' ) );
422			});
423			$( this ).attr( 'data-structure', data_structure.join("-") );
424		});
425		
426		$( '.bt_bb_row_inner' ).each( function( index ) {
427			var data_structure = [];
428			$( this ).data( 'structure', "0" );
429			$( this ).find('.bt_bb_column_inner').each( function( index ) {
430				data_structure.push( $( this ).data( 'width' ) );
431			});
432			$( this ).attr( 'data-structure', data_structure.join("-") );
433		});
434		
435		// slick slider
436		
437		$( '.slick-slider' ).slick();
438		$( '.slick-slider .slick-prev, .slick-slider .slick-next, .slick-slider .slick-dots li' ).on( 'click', function() {
439			$( this ).closest( '.slick-slider' ).slick( 'slickPause' );
440		});
441		$( '.bt_bb_slider.bt_bb_use_lightbox .slick-slider .bt_bb_slider_item' ).on( 'click', function() {
442			$( this ).closest( '.slick-slider' ).slick( 'slickPause' );
443		});
444		
445		// image slider lightbox
446		
447		$( '.bt_bb_slider.bt_bb_use_lightbox' ).each(function() {
448			$( this ).magnificPopup({
449				delegate: '.bt_bb_slider_item:not(.slick-cloned)',
450				type: 'image',
451				gallery:{
452					enabled: true
453				},
454				callbacks: {
455					elementParse: function( item ) { item.src = item.el.data( 'src-full' ); }
456				},
457				closeBtnInside: false,
458				fixedContentPos: false
459			});
460		});
461		
462		// masonry image grid lighbox
463		
464		$( '.bt_bb_masonry_image_grid' ).not( '.bt_bb_no_lightbox' ).each(function() {
465			$( this ).magnificPopup({
466				delegate: '.bt_bb_grid_item',
467				type: 'image',
468				gallery:{
469					enabled: true
470				},
471				callbacks: {
472					elementParse: function( item ) { item.src = item.el.data( 'src-full' ); }
473				},
474				closeBtnInside: false,
475				fixedContentPos: false
476			});
477		});
478		
479		// css image grid lighbox
480		
481		window.bt_bb_init_css_image_grid_lightbox();
482		
483		// image lightbox
484		
485		$( document ).on( 'click', '.bt_bb_image.bt_bb_use_lightbox a', function() {
486			
487			var url = $( this ).attr( 'href' ).trim();
488			
489			if ( url != "" && url != "#" && url != "#lightbox" ) {
490				var contentType = url.toLowerCase().includes( '.jpg' ) || url.toLowerCase().includes( '.jpeg' ) || url.toLowerCase().includes( '.png' ) ? 'image' : 'iframe';
491				$.magnificPopup.open({
492					type: contentType,
493					items: {
494						src: url,
495						title: $( this ).attr( 'title' ),
496					},
497					closeBtnInside: false
498				});
499			
500			} else {
501				var url = $( this ).find('img').attr( 'data-full_image_src' );
502				$.magnificPopup.open({
503					type: 'image',
504					items: {
505						src: url,
506						title: $( this ).attr( 'title' ),
507					},
508					closeBtnInside: false,
509					fixedContentPos: false
510				});
511				return false;
512			}
513			return false;
514		});
515		
516		// button, icon, service lightbox
517		
518		$( document ).on( 'click', '.bt_bb_button.bt_bb_use_lightbox a, .bt_bb_icon.bt_bb_use_lightbox a, .bt_bb_service.bt_bb_use_lightbox a', function() {
519				
520			var url = $( this ).attr( 'href' );
521			var contentType = url.toLowerCase().includes( '.jpg' ) || url.toLowerCase().includes( '.jpeg' ) || url.toLowerCase().includes( '.png' ) ? 'image' : 'iframe';
522			
523			$.magnificPopup.open({
524				type: contentType,
525				items: {
526					src: url,
527					title: $( this ).attr( 'title' ),
528				},
529				closeBtnInside: false
530			});		
531			
532			return false;				
533			
534		});
535
536		// force slider item equal height when keep height is active
537
538		$('.bt_bb_content_slider.bt_bb_height_keep-height .slick-slider').on('setPosition', function () {
539			bt_bb_fix_slider_heights();
540			$( this ).find( '*[aria-hidden=true] a, *[aria-hidden=true] button' ).attr( 'tabindex', -1 );
541			$( this ).find( '*[aria-hidden=false] a, *[aria-hidden=false] button' ).removeAttr( 'tabindex' );
542		});
543		$(window).on('resize', function(e) {
544			bt_bb_fix_slider_heights();
545			bt_bb_get_screen_resolution();
546		});
547		 	
548		// bt_bb_elements.js resets animated class
549		$( '.slick-slider' ).on('beforeChange', function(event, slick, currentSlide, nextSlide){
550		  $( this ).find( '.slick-slide .animated' ).removeClass( 'animated' );
551		  $( this ).find( '.slick-slide[data-slick-index='+nextSlide+'] .animate' ).addClass( 'animated' );
552		});
553
554		// tabs
555		
556		window.bt_bb_init_tabs();
557		
558		// Detect touch
559		
560		bt_detect_touch();
561		
562		// Get screen resolution
563		
564		bt_bb_get_screen_resolution();
565
566		// parallax
567		
568		bt_bb_check_fixed_background();
569		
570		if ( $( 'html.bt_bb_backgroud_fixed_supported .bt_bb_parallax' ).length > 0 ) {
571
572			window.bt_bb_raf_lock = false;
573
574			$( window ).on( 'mousewheel', function( e ) { });
575			
576			$( window ).on( 'scroll', function() {
577				if ( ! window.bt_bb_raf_lock ) {
578					window.bt_bb_raf_lock = true;
579					bt_bb_requestAnimFrame( bt_bb_raf_loop );
580				}
581			});
582			
583			bt_bb_requestAnimFrame( bt_bb_raf_loop );
584
585			$( window ).on( "load", function() { 
586				bt_bb_requestAnimFrame( bt_bb_raf_loop );
587			});
588
589		}
590
591		// Countdown
592		
593		setInterval(function() { // temporary put outside to enable adding new elements on FE
594			$( '.btCountdownHolder' ).each(function() {
595				bt_bb_countdown_output( $( this ) );
596			});
597		}, 1000 );
598		
599		// Accordion
600		
601		$( '.bt_bb_wrapper' ).on( 'click', '.bt_bb_accordion_item_title', function() {
602			var $item = $( this ).closest( '.bt_bb_accordion_item' );
603			if ( ! $item.hasClass('on') ) {
604				$( this ).closest( '.bt_bb_accordion' ).find( '.bt_bb_accordion_
604item.on' ).removeClass( 'on' );
605				$item.addClass( 'on' );
606				if( ! window.bt_bb_initialaccordion ) { 
607					var top_of_element = $item.offset().top;
608					var bottom_of_element = $item.offset().top + $("#element").outerHeight();
609					var bottom_of_screen = $( window ).scrollTop() + $(window).innerHeight();
610					var top_of_screen = $( window ).scrollTop();
611					var diff = top_of_screen - top_of_element;
612					if( diff > 0 ) {
613						$( 'html' ).scrollTop( $( 'html' ).scrollTop() - diff - 15 );
614					}
615
616				} else {
617					window.bt_bb_initialaccordion = false;
618				}
619			
620			} else {
621				$( this ).closest( '.bt_bb_accordion_item' ).removeClass( 'on' );
622			}
623		});
624		$( '.bt_bb_accordion' ).each(function() {
625			if ( $( this ).data( 'closed' ) != 'closed' ) {
626				window.bt_bb_initialaccordion = true;
627				$( this ).find( '.bt_bb_accordion_item_title' ).first().click();
628			}
629		});
630		
631	}
632
633	// google maps
634	
635	window.bt_bb_gmap_init_static_new = function ( map_id ) {
636		var mapElement_jQuery = jQuery( '#' + map_id );
637		if ( mapElement_jQuery.data( 'init-finished' ) == true ) return false;
638		var zoom = ( typeof mapElement_jQuery.data( 'zoom' ) !== 'undefined' ) ? mapElement_jQuery.data( 'zoom' ) : 8;
639		var custom_style = ( typeof mapElement_jQuery.data( 'custom-style' ) !== 'undefined' ) ? mapElement_jQuery.data( 'custom-style' ).trim() : '';
640		var api_key = ( typeof mapElement_jQuery.data( 'api-key' ) !== 'undefined' ) ? mapElement_jQuery.data( 'api-key' ) : '';
641		var height = ( typeof mapElement_jQuery.data( 'height' ) !== 'undefined' ) ? mapElement_jQuery.data( 'height' ) : 0;
642		bt_bb_gmap_init_static( map_id, zoom, custom_style, height, api_key );
643		mapElement_jQuery.data( 'init-finished', true );
644		
645	}
646	
647	window.bt_bb_gmap_init_new = function ( map_id ) {
648		var mapElement_jQuery = jQuery( '#' + map_id );
649		if ( mapElement_jQuery.data( 'init-finished' ) == true ) return false;
650		var zoom = ( typeof mapElement_jQuery.data( 'zoom' ) !== 'undefined' ) ? mapElement_jQuery.data( 'zoom' ) : 8;
651		var custom_style = ( typeof mapElement_jQuery.data( 'custom-style' ) !== 'undefined' ) ? mapElement_jQuery.data( 'custom-style' ).trim() : '';
652		bt_bb_gmap_init( map_id, zoom, custom_style );
653		mapElement_jQuery.data( 'init-finished', true );
654	}
655	
656	document.addEventListener( 'readystatechange', function() {  
657		if ( ( document.readyState === 'complete' ) ) {  
658			if ( typeof( bt_bb_init_all_maps ) !== 'function' ) { 
659				return false;
660			}
661			window.bt_bb_init_all_maps();
662		};
663	}, false);
664	
665	// callback from gmaps api
666	window.bt_bb_init_all_maps = function () {
667		jQuery( '.bt_bb_google_maps_map' ).each(function( index ) {
668			if ( jQuery( this ).data( 'map-type' ) != 'static' ) {
669				bt_bb_gmap_init_new( jQuery( this ).attr( 'id' ) );
670			} else {
671				bt_bb_gmap_init_static_new( jQuery( this ).attr( 'id' ) );
672			};
673		});
674	};
675
676	window.bt_bb_gmap_init_static = function ( map_id, zoom, custom_style, height, api_key ) {
677		
678		if ( parseInt( height ) <= 0 ) height = 400;
679		
680		var container = jQuery( '#' + map_id ).parent();
681		var googleApiMapId = document.getElementById( map_id ).id;
682		
683		var locations = container.find( '.bt_bb_map_location' );
684		
685		var center_map = container.data( 'center' );
686		if ( center_map == 'no' ) {
687			center_map = false;
688		} else {
689			center_map = true;
690		}
691
692		var lat_sum = 0;
693		var lng_sum = 0;
694		var markerStr = '';
695		var n = 0;
696		var colors = ['blue', 'green', 'red', 'purple', 'yellow', 'gray', 'orange', 'white', 'black', 'brown' ];
697		
698		var centerLatLng;
699	
700		locations.each(function() {
701			
702			var lat = jQuery( this ).data( 'lat' );
703			var lng = jQuery( this ).data( 'lng' );
704			var iconStr = jQuery( this ).data( 'icon' ) != "" ? 'scale:2%7Cicon:' + jQuery( this ).data( 'icon' ) : 'size:mid%7Ccolor:' + colors[n];
705
706			lat_sum += parseFloat(lat);
707			lng_sum += parseFloat(lng);
708			
709			markerStr += '&markers=' + iconStr + '%7C' + lat + ',' + lng;
710
711			centerLatLng = [ lat, lng ];
712
713			n++;
714		});
715
716		if ( center_map ) {
717			centerLatLng = [ lat_sum / n, lng_sum / n ];
718		}
719		
720		if ( atob( custom_style ).startsWith( '[' ) ) custom_style = '';
721		
722		var img_src = '<img src="https://maps.googleapis.com/maps/api/staticmap?center=' + centerLatLng.toString() + '&zoom=' + zoom + markerStr + '&size=640x' + height + '&scale=2&style=' + atob( custom_style ) + '&key=' + api_key + '">';
723		container.find( '.bt_bb_google_maps_map.bt_bb_map_map' ).append( img_src ).on('click', function(){ $( '.bt_bb_map_location_show' ).removeClass( 'bt_bb_map_location_show' ).nextOrFirst().addClass( 'bt_bb_map_location_show' ) });
724		
725		locations.eq( 0 ).addClass( 'bt_bb_map_location_show' );
726		
727		jQuery( '#' + map_id ).data( 'init-finished', true );
728		
729	}
730	
731	$.fn.nextOrFirst = function( selector ) {
732	  var next = this.next( selector );
733	  return ( next.length ) ? next : this.prevAll( selector ).last();
734	};
735	
736	window.bt_bb_gmap_init = function( map_id, zoom, custom_style ) {
737
738		var mapElement = document.getElementById( map_id );
739		
740		var myLatLng = new google.maps.LatLng( 0, 0 );
741		
742		var googleApiMapId = mapElement.id;
743		
744		var mapOptions = {
745			mapId: googleApiMapId,
746			zoom: zoom,
747			center: myLatLng,
748			scrollwheel: false,
749			scaleControl:true,
750			zoomControl: true,
751			zoomControlOptions: {
752				style: google.maps.ZoomControlStyle.SMALL,
753				position: google.maps.ControlPosition.RIGHT_CENTER
754			},
755			streetViewControl: true,
756			mapTypeControl: true
757		}
758
759		if ( mapElement )
760		{
761			var map = new google.maps.Map( mapElement, mapOptions );
762		
763			if ( custom_style != '' && atob( custom_style ).startsWith( '[' ) ) {
764					
765				var style_array = [];
766				
767				if ( custom_style != '' ) {
768					style_array = JSON.parse( atob( custom_style ) );
769				}
770				
771				var customMapType = new google.maps.StyledMapType( style_array, {
772					name: 'Custom Style'
773				});
774
775				var customMapTypeId = 'custom_style';
776				map.mapTypes.set( customMapTypeId, customMapType );
777				map.setMapTypeId( customMapTypeId );
778			} else {
779				
780			}
781
782			var n = 0;
783
784			var container = jQuery( '#' + map_id ).parent();
785			
786			var locations = container.find( '.bt_bb_map_location' );
787			
788			var center_map = container.data( 'center' );
789			if ( center_map == 'no' ) {
790				center_map = false;
791			} else {
792				center_map = true;
793			}
794
795			var lat_sum = 0;
796			var lng_sum = 0;
797		
798			locations.each(function() {
799				
800				var lat = jQuery( this ).data( 'lat' );
801				var lng = jQuery( this ).data( 'lng' );
802				var icon = jQuery( this ).data( 'icon' );
803
804				lat_sum += parseFloat(lat);
805				lng_sum += parseFloat(lng);
806
807				var myLatLng = new google.maps.LatLng( lat, lng );
808				var marker = new google.maps.Marker({
809					position: myLatLng,
810					map: map,
811					icon: icon,
812					count: n
813				});
814				
815				if ( ! center_map && n == 0 ) {
816					map.setCenter( myLatLng );
817				}
818				
819				locations.eq( 0 ).addClass( 'bt_bb_map_location_show' );
820				
821				marker.addListener( 'click', function() {
822					//map.setZoom( zoom );
823					//map.setCenter( marker.getPosition() );
824					var reload = true;
825					if ( locations.eq( this.count ).hasClass( 'bt_bb_map_location_show' ) && !container.hasClass( 'bt_bb_map_no_overlay' ) ) reload = false; 
826					container.removeClass( 'bt_bb_map_no_overlay' );
827					locations.removeClass( 'bt_bb_map_location_show' );
828					if ( reload ) locations.eq( this.count ).addClass( 'bt_bb_map_location_show' );
829				});
830				
831				n++;
832			});
833
834			if ( center_map ) {
835				var centerLatLng = new google.maps.LatLng( lat_sum / n, lng_sum / n );
836				map.setCenter( centerLatLng );
837			}
838		}
839		
840		jQuery( '#' + map_id ).data( 'init-finished', true );
841		
842	}
843	
844	// leaflet map init
845	
846	var map = null;
847	 
848	window.bt_bb_leaflet_init = function ( map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control ) { 
849		onImagesLoaded( $('#' + map_id ).parent(), function() {
850			bt_bb_leaflet_init_late ( map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control );
851		});
852
853	}
854	
855	window.bt_bb_leaflet_init_late_all = function() {
856		jQuery( '.bt_bb_leaflet_map_map' ).not( '.leaflet-container' ).each(function() {
857			window.bt_bb_leaflet_init_late( jQuery( this ).attr( 'id' ), jQuery( this ).data( 'zoom' ), jQuery( this ).data( 'max_zoom' ), jQuery( this ).data( 'predefined_style' ), jQuery( this ).data( 'custom_style' ), jQuery( this ).data( 'scroll_wheel' ), jQuery( this ).data( 'zoom_control' ) );
858		});
859	}
860	
861	window.bt_bb_leaflet_init_late = function ( map_id, zoom, max_zoom, predefined_style, custom_style, scroll_wheel, zoom_control ) {
862		
863		var lat_center     = 0;
864		var lng_center     = 0;
865
866		var container   = jQuery( '#' + map_id ).parent();
867		var locations   = container.find( '.bt_bb_leaflet_map_location' );
868		
869		var center_map = container.data( 'center' );
870		
871		if ( center_map == 'no' ) {
872			center_map = false;
873		} else {
874			center_map = true;
875		}
876		
877		var markerClusters = L.markerClusterGroup();
878		
879		var lat_sum = 0;
880		var lng_sum = 0; 
881		var n = 0;
882
883		locations.each(function() {
884
885			var lat     = jQuery( this ).data( 'lat' );
886			var lng     = jQuery( this ).data( 'lng' );
887			var icon    = jQuery( this ).data( 'icon' );
888			lat_sum += parseFloat(lat);
889			lng_sum += parseFloat(lng);
890			
891			if ( n == 0 ) {
892				 lat_center  = lat;
893				 lng_center  =  lng;
894			} 
895			locations.eq( 0 ).addClass( 'bt_bb_map_location_show' ); 
896			locations.eq( 0 ).addClass( 'bt_bb_map_location_show' );
897			
898			var myIcon = L.icon({
899				iconUrl: icon,
900				iconRetinaUrl: icon,
901				iconSize: [45, 58],
902				iconAnchor: [22, 58],
903				popupAnchor: [0, -14]
904			  });
905			  
906			var m = L.marker( [ lat, lng ], { icon: myIcon, id: n,  lat: lat, lng:lng } ).on("click", markerOnClick);
907			markerClusters.addLayer( m );  
908			
909			n++;
910		});
911		
912		if ( center_map ) {
913			lat_center  = lat_sum / n;
914			lng_center  = lng_sum / n;
915		}
916
917		map = L.map( document.getElementById( map_id ) ).setView( [lat_center, lng_center], zoom );
918		
919		var tiles_arr = [];
920		
921		if ( parseInt( predefined_style ) > 0 ) {
922			tiles_arr = tiles_arr.concat( map_leaflet_source_arr[ predefined_style ] );
923		} 
924		
925		if ( custom_style != '' ) {
926			custom_style = atob(custom_style);
927			var tmp_arr = custom_style.split('\n');
928			$.each( tmp_arr, function ( index, tmp ) {
929				
930				tiles_arr = tiles_arr.concat( [tmp.split(',')] );
931			} );
932		}
933		
934		$.each( tiles_arr, function ( index, tile ) {
935			L.tileLayer( 
936				tile[0], 
937				{
938					attribution: tile[1],
939					maxZoom: max_zoom,
940					subdomains: ['a','b','c']
941				}
942			).addTo( map );			
943		} );
944		
945		map.addLayer( markerClusters );
946
947		if ( scroll_wheel == '' ) {
948			map.scrollWheelZoom.disable();
949		}
950		
951		map.removeControl(map.zoomControl);
952		
953		if ( zoom_control ) {
954			L.control.zoom({
955				 position:'topright'
956			}).addTo(map);		
957		}
958
959		function markerOnClick( e ) {
960			var attributes = e.target.options;
961			var id = attributes.id;
962			var reload = true;
963			if ( locations.eq( id ).hasClass( 'bt_bb_leaflet_map_location_show' ) && !container.hasClass( 'bt_bb_leaflet_map_no_overlay' ) ) reload = false; 
964			container.removeClass( 'bt_bb_leaflet_map_no_overlay' );
965			locations.removeClass( 'bt_bb_leaflet_map_location_show' );
966			if ( reload ) locations.eq( id ).addClass( 'bt_bb_leaflet_map_location_show' );
967			
968			if ( locations.eq( id ).hasClass( 'bt_bb_map_location_show' ) && !container.hasClass( 'bt_bb_map_no_overlay' ) ) reload = false; 
969			container.removeClass( 'bt_bb_map_no_overlay' );
970			locations.removeClass( 'bt_bb_map_location_show' );
971			if ( reload ) locations.eq( id ).addClass( 'bt_bb_map_location_show' );
972		}
973	} 
974	
975	// do event if all images in container are loaded
976	
977	function onImagesLoaded( container, event ) {
978		var images = container.find( '.bt_bb_leaflet_map_content img' );
979		var loaded = images.length;
980		if ( loaded > 0 ) {
981			for (var i = 0; i < images.length; i++ ) {
982				if ( images[i].complete ) {
983					loaded--;
984					if ( loaded == 0 ) {
985						event();
986					}
987				} else {
988					images[i].addEventListener( 'load', function() {
989						loaded--;
990						if ( loaded == 0 ) {
991							event();
992						}
993					});
994					setTimeout( function() { loaded--; console.log( 'Image loaded without proof: ' + loaded ); if ( loaded == 0 ) { event(); } }, 3000 );
995				}
996			}			
997		} else {
998			event();
999		} 
1000	}
1001	
1002	// general init
1003	
1004	var bt_bb_init_finished = false;
1005	
1006	document.addEventListener('readystatechange', function() {
1007		if ( ! bt_bb_init_finished && ( document.readyState === 'interactive' || document.readyState === 'complete' ) ) {
1008			bt_bb_init_elements();			
1009		
1010			if( ! $('body').hasClass('bodyPreloader') ) {
1011				bt_bb_animate_elements();	
1012			} else {
1013				setTimeout( function() {
1014					bt_bb_animate_elements();
1015				}, 5000 );
1016			}
1017			$( window ).on( 'scroll', function() { 
1018				bt_bb_animate_elements(); 
1019			});
1020			$( window ).on( 'resize', function( e ) {		
1021				setTimeout( function() {
1022					var $elems = $( '.bt_bb_counter.animated' );
1023					$elems.each(function() {
1024						var $elm = $( this );
1025						$elm.removeClass( 'animated' );
1026						bt_bb_animate_counter( $elm );
1027					});
1028				}, 1000 );		
1029			});
1030			bt_bb_init_finished = true;		
1031		}
1032
1033	}, false);
1034	
1035	// magnificPopup swipe
1036	
1037	function mfp_swipe() {
1038		var touch_start = false;
1039		var touch_end = false;
1040		var one_finger = true;
1041		$( document ).on( 'touchstart', '.mfp-figure figure', function( e ) {
1042			const touches = e.changedTouches;
1043			if ( touches.length == 1 ) {
1044				touch_start = touches[0].clientX;
1045			} else {
1046				one_finger = false;
1047			}
1048		});
1049		$( document ).on( 'touchmove', '.mfp-figure figure', function( e ) {
1050			const touches = e.changedTouches;
1051			if ( touches.length > 1 ) {
1052				one_finger = false;
1053			}
1054		});
1055		$( document ).on( 'touchend', '.mfp-figure figure', function( e ) {
1056			const touches = e.changedTouches;
1057			if ( touches.length == 1 && one_finger ) {
1058				touch_end = touches[0].clientX;
1059				if ( touch_start - touch_end < -50 ) {
1060					$( '.mfp-arrow-left' ).click();
1061				} else if ( touch_start - touch_end > 50 ) {
1062					$( '.mfp-arrow-right' ).click();
1063				}
1064			}
1065			one_finger = true;
1066		});
1067	}
1068	mfp_swipe();
1069
1070}( 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.