PageSourceSearch

https://tunisavia.com.tn/wp-content/plugins/bold-page-builder/cont…/js/content_elements.js?ver=5.9.18

js tunisavia.com.tn collected 2026-10-02 23:16:30 UTC 21,046 bytes, 751 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			}
14		});
15		bt_bb_lazy_load_images();
16		$( '.slick-slider .slick-slide:not(.slick-active) .animate' ).removeClass( 'animated' );
17	}
18	
19	// lazy image load
20	window.bt_bb_lazy_load_images = function() {
21		var $elems = $( 'img.btLazyLoadImage:not(.btLazyLoaded)' );
22		$elems.each(function() {
23			var $elm = $(this);
24			if ( isOnScreen( $elm, -200 ) ) {
25				$elm.addClass( 'btLazyLoaded' );
26				// console.log($elm.data( 'image_src' ));
27				$elm.attr( 'src', $elm.data( 'image_src' ));
28			}
29		});
30		var $elems = $( 'image.btLazyLoadImage:not(.btLazyLoaded)' );
31		$elems.each(function() {
32			var $elm = $(this);
33			if ( isOnScreen( $elm, -200 ) ) {
34				$elm.addClass( 'btLazyLoaded' );
35				// console.log($elm.data( 'image_src' ));
36				$elm.attr( 'xlink:href', $elm.data( 'image_src' ));
37			}
38		});
39		var $elems = $( '.btLazyLoadBackground:not(.btLazyLoaded)' );
40		$elems.each(function() {
41			var $elm = $(this);
42			if ( isOnScreen( $elm, -200 ) ) {
43				$elm.addClass( 'btLazyLoaded' );
44				$elm.css( 'background-image', 'url(' + $elm.data( 'background_image_src' ) + ')' );
45			}
46		});
47	}
48	
49	// isOnScreen fixed
50	
51	function iOSversion() {
52	  if (/iP(hone|od|ad)/.test(navigator.platform)) {
53		// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
54		var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
55		return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
56	  } else {
57		  return false;
58	  }
59	}
60
61	var ver = iOSversion();
62	
63	// isOnScreen
64	
65	function isOnScreen( elem, top_offset ) {
66		if ( ver && ver[0] == 13 ) return true;
67		top_offset = ( top_offset === undefined ) ? 75 : top_offset;
68		var element = elem.get( 0 );
69		if ( element == undefined ) return false;
70		var bounds = element.getBoundingClientRect();
71		var output = bounds.top + top_offset < window.innerHeight && bounds.bottom > 0;
72		// alert(output);
73		return output;
74	}
75
76	// animate counter
77	
78	function bt_bb_animate_counter( elm ) {
79		var number_length = elm.data( 'digit-length' );
80		for ( var i = parseInt( number_length ); i > 0; i-- ) {
81			var digit = parseInt( elm.children( '.p' + i ).data( 'digit' ) );
82			if ( digit == 0 ) digit = 10;
83			if ( isNaN( digit ) ) digit = 10;
84			for ( var j = 0; j <= digit; j++ ) {
85				elm.children( '.p' + i ).css( 'transform', 'translateY(-' + digit * elm[0].getBoundingClientRect().height + 'px)' );
86			}
87			elm.addClass( 'animated' );
88		}
89		
90		return false;
91	}
92	
93	// paralax helpers 
94	
95	window.bt_bb_requestAnimFrame = function() {
96		return (
97			window.requestAnimationFrame       ||
98			window.webkitRequestAnimationFrame ||
99			window.mozRequestAnimationFrame    ||
100			window.oRequestAnimationFrame      ||
101			window.msRequestAnimationFrame     ||
102			function( callback ) {
103				window.setTimeout( callback, 1000 / 60 );
104			}
105		);
106	}();
107	
108	window.is_edge = ( navigator.userAgent.indexOf('Edge') !== -1 ) ? true : false;
109
110	window.bt_bb_raf_loop = function() {
111		var win_w = window.innerWidth;
112		var win_h = window.innerHeight;
113		$( 'html.bt_bb_backgroud_fixed_supported .bt_bb_parallax' ).each(function() {
114			if ( $( 'html' ).attr( 'data-bt_bb_screen_resolution' ) !== 'lg' ) {
115				$( this )[0].style.backgroundPosition = 'center center';
116				return false;
117			} else {
118					var bounds = this.getBoundingClientRect();
119					if ( bounds.top < win_h && bounds.bottom > 0 ) {
120						var speed = $( this ).data( 'parallax' ) + 0.0001;
121						if ( window.is_edge ) speed = - speed / 5;
122						var offset = 0;
123						if ( win_w > 1024 ) offset = parseFloat( $( this ).data( 'parallax-offset' ) );
124						var ypos = ( bounds.top ) * speed;
125						if ( ypos > -0.5 && ypos < 0.5  ) {
126							ypos = 0;
127						}
128						$( this )[0].style.backgroundPosition = '50% ' + ( ypos + offset ) + 'px';	
129					}				
130			}
131
132
133		});
134		window.bt_bb_raf_lock = false;
135	}
136	
137	// touch screen detect
138	
139	window.bt_detect_touch = function() {
140	  if (typeof window !== 'undefined') {
141		var bt_has_touch = Boolean(
142		  'ontouchstart' in window ||
143		  window.navigator.maxTouchPoints > 0 ||
144		  window.navigator.msMaxTouchPoints > 0 ||
145		  window.DocumentTouch && document instanceof DocumentTouch
146		);
147		if ( bt_has_touch ) $('html').addClass( 'bt_bb_touch' );
148	  }
149	}
150	
151	// screen detect
152	
153	window.bt_bb_get_screen_resolution = function() {
154		var width = Math.max(
155		document.documentElement.clientWidth,
156		window.innerWidth || 0
157		);
158		var res = 'lg';
159		if (width <= 480) res = 'xs';
160		if (width <= 768) res = 'ms';
161		if (width <= 992) res = 'sm';
162		if (width <= 1200) res = 'md';
163		// alert(res);
164		$( 'html' ).attr( 'data-bt_bb_screen_resolution', res );
165	}
166
167
168	
169	// Test fixed background support for iOS devices
170	
171	window.bt_bb_check_ios_fixed_background_support = function() {
172		return ( /iPad|iPhone|iPod/.test(navigator.userAgent) && ! window.MSStream ) ||
173			   ( /MacIntel/.test(navigator.platform) && $('html').hasClass( 'bt_bb_touch' ) );
174			   
175			   /* /MacIntel/... <- checks iPadPro */
176	}
177	
178	// Test fixed background support
179	
180	window.bt_bb_check_fixed_background = function() {
181		var el = document.createElement('div');
182		try {
183			if ( ! ( 'backgroundAttachment' in el.style ) || bt_bb_check_ios_fixed_background_support() ) {
184				$( 'html' ).removeClass( 'bt_bb_backgroud_fixed_supported' );
185				return false;
186			}
187			el.style.backgroundAttachment = 'fixed';
188			if ( ( 'fixed' === el.style.backgroundAttachment ) ) {
189				$( 'html' ).addClass( 'bt_bb_backgroud_fixed_supported' );
190				return true;			
191			}
192		}
193		catch (e) {
194			$( 'html' ).removeClass( 'bt_bb_backgroud_fixed_supported' );
195			return false;
196		}
197	}
198	
199	// Countdown timer helpers
200	
201	window.bt_bb_countdown = function( elem, selector, i, arr, arr_prev ) {
202		
203		if ( arr[ i ] !== arr_prev[ i ] || elem.find( selector ).children().eq( 0 ).html( ) == '' ) {
204			elem.find( selector ).children().addClass( 'countdown_anim' );
205			elem.find( selector ).children().eq( 0 ).html( arr[ i ] );
206			elem.find( selector ).children().eq( 1 ).html( arr_prev[ i ] );
207			setTimeout(function() {
208				elem.find( selector ).children().eq( 1 ).html( elem.find( selector ).children().eq( 0 ).html() );
209				elem.find( selector ).children().removeClass( 'countdown_anim' );
210			}, 300 );
211		}
212	}
213	
214	window.bt_bb_countdown_output = function( elem ) {
215		
216		var s = elem.data( 'init-seconds' );
217		
218		var delta = s;
219		
220		var days = Math.floor( delta / 86400 );
221		delta -= days * 86400;
222
223		var hours = Math.floor( delta / 3600 ) % 24;
224		delta -= hours * 3600;
225
226		var minutes = Math.floor( delta / 60 ) % 60;
227		delta -= minutes * 60;
228
229		var seconds = delta;
230		
231		if ( hours < 10 ) {
232			hours = '0' + hours;
233		}
234		
235		if ( minutes < 10 ) {
236			minutes = '0' + minutes;
237		}
238
239		if ( seconds < 10 ) {
240			seconds = '0' + seconds;
241		}
242		
243		var seconds_arr_prev = seconds.toString().split( '' );
244		var minutes_arr_prev = minutes.toString().split( '' );
245		var hours_arr_prev = hours.toString().split( '' );		
246		
247		s = s - 1;
248		if ( s < 0 ) {
249			s = 0;
250		}
251		
252		var delta = s;
253		
254		var days = Math.floor( delta / 86400 );
255		delta -= days * 86400;
256
257		var hours = Math.floor( delta / 3600 ) % 24;
258		delta -= hours * 3600;
259
260		var minutes = Math.floor( delta / 60 ) % 60;
261		delta -= minutes * 60;
262
263		var seconds = delta;
264		
265		if ( hours < 10 ) {
266			hours = '0' + hours;
267		}
268		
269		if ( minutes < 10 ) {
270			minutes = '0' + minutes;
271		}
272
273		if ( seconds < 10 ) {
274			seconds = '0' + seconds;
275		}
276		
277		var seconds_arr = seconds.toString().split( '' );
278		var minutes_arr = minutes.toString().split( '' );
279		var hours_arr = hours.toString().split( '' );
280		
281		for ( var i = 0; i <= 1; i++ ) {
282			bt_bb_countdown( elem, '.seconds .n' + i, i, seconds_arr, seconds_arr_prev );
283			bt_bb_countdown( elem, '.minutes .n' + i, i, minutes_arr, minutes_arr_prev );
284			bt_bb_countdown( elem, '.hours .n' + i, i, hours_arr, hours_arr_prev );
285		}
286		
287		var days_prev = 0;
288		
289		if ( days != days_prev ) {
290			var days_arr = days.toString().split( '' );
291			
292			var days_html = '';
293			for ( var i = 0; i < days_arr.length; i++ ) {
294				days_html += '<span>' + days_arr[ i ] + '</span>';
295			}
296
297			elem.find( '.days' ).html( days_html + '<span class="days_text"><span>' + elem.find( '.days' ).data( 'text' ) + '</span></span>' );
298		}
299		
300		days_prev = days;
301
302		elem.data( 'init-seconds', s );		
303
304	}
305	
306	function bt_bb_fix_slider_heights(){
307		$( '.bt_bb_content_slider.bt_bb_height_keep-height .slick-slider' ).each(function( index ) {
308			$( this ).find('.slick-slide').height('auto');
309			var slickTrack = $( this ).find('.slick-track');
310			var slickTrackHeight = $(slickTrack).height();
311			$( this ).find('.slick-slide').css('height', slickTrackHeight + 'px');
312		});
313	}
314
315	function bt_bb_init_elements() {
316		
317		// get row structure
318		
319		$( '.bt_bb_section .bt_bb_row' ).each( function( index ) {
320			var data_structure = [];
321			$( this ).data( 'structure', "0" );
322			$( this ).find('.bt_bb_column').each( function( index ) {
323				data_structure.push( $( this ).data( 'width' ) );
324			});
325			$( this ).attr( 'data-structure', data_structure.join("-") );
326		});
327		
328		$( '.bt_bb_row_inner' ).each( function( index ) {
329			var data_structure = [];
330			$( this ).data( 'structure', "0" );
331			$( this ).find('.bt_bb_column_inner').each( function( index ) {
332				data_structure.push( $( this ).data( 'width' ) );
333			});
334			$( this ).attr( 'data-structure', data_structure.join("-") );
335		});
336		
337		// slick slider
338		
339		$( '.slick-slider' ).slick();
340		$( '.slick-slider .slick-prev, .slick-slider .slick-next, .slick-slider .slick-dots li' ).click(function() {
341			$( this ).closest( '.slick-slider' ).slick( 'slickPause' );
342		});
343		$( '.bt_bb_slider.bt_bb_use_lightbox .slick-slider .bt_bb_slider_item' ).click(function() {
344			$( this ).closest( '.slick-slider' ).slick( 'slickPause' );
345		});
346		
347		// image slider lightbox
348		
349		$( '.bt_bb_slider.bt_bb_use_lightbox' ).each(function() {
350			$( this ).magnificPopup({
351				delegate: '.bt_bb_slider_item',
352				type: 'image',
353				gallery:{
354					enabled: true
355				},
356				callbacks: {
357					elementParse: function( item ) { item.src = item.el.data( 'src-full' ); }
358				},
359				closeBtnInside: false,
360				fixedContentPos: false
361			});
362		});
363		
364		// image lightbox
365		
366		$( '.bt_bb_image.bt_bb_use_lightbox a' ).each(function() {
367			$( this ).magnificPopup({
368				delegate: 'img',
369				type: 'image',
370				gallery:{
371					enabled: true
372				},
373				callbacks: {
374					elementParse: function( item ) { item.src = item.el.data( 'full_image_src' ); }
375				},
376				closeBtnInside: false,
377				fixedContentPos: false
378			});
379			/*return false;*/
380		});
381
382		// force slider item equal height when keep height is active
383
384		$('.bt_bb_content_slider.bt_bb_height_keep-height .slick-slider').on('setPosition', function () {
385			bt_bb_fix_slider_heights();
386		});
387		$(window).on('resize', function(e) {
388			bt_bb_fix_slider_heights();
389			bt_bb_get_screen_resolution();
390		});
391		 	
392		// bt_bb_elements.js resets animated class
393		$( '.slick-slider' ).on('beforeChange', function(event, slick, currentSlide, nextSlide){
394		  $( this ).find( '.slick-slide .animated' ).removeClass( 'animated' );
395		  $( this ).find( '.slick-slide[data-slick-index='+nextSlide+'] .animate' ).addClass( 'animated' );
396		});
397
398		// tabs
399		$( '.bt_bb_tabs .bt_bb_tabs_header li' ).click(function() {
400			$( this ).siblings().removeClass( 'on' );
401			$( this ).addClass( 'on' );
402			$( this ).closest( '.bt_bb_tabs' ).find( '.bt_bb_tab_item' ).removeClass( 'on' );
403			$( this ).closest( '.bt_bb_tabs' ).find( '.bt_bb_tab_item' ).eq( $( this ).index() ).addClass( 'on' );
404			
405
406		});
407		$( '.bt_bb_tabs' ).each(function() {
408			$( this ).find( 'li' ).first().click();
409		});
410		
411		// Detect touch
412		
413		bt_detect_touch();
414		
415		// Get screen resolution
416		
417		bt_bb_get_screen_resolution();
418
419		// parallax
420		
421		bt_bb_check_fixed_background();
422		
423		if ( $( 'html.bt_bb_backgroud_fixed_supported .bt_bb_parallax' ).length > 0 ) {
424
425
426			window.bt_bb_raf_lock = false;
427
428			$( window ).on( 'mousewheel', function( e ) { });
429			
430			$( window ).on( 'scroll', function() {
431				if ( ! window.bt_bb_raf_lock ) {
432					window.bt_bb_raf_lock = true;
433					bt_bb_requestAnimFrame( bt_bb_raf_loop );
434				}
435			});
436			
437			bt_bb_requestAnimFrame( bt_bb_raf_loop );
438
439			$( window ).on( "load", function() { 
440				bt_bb_requestAnimFrame( bt_bb_raf_loop );
441			});
442
443		}
444
445		// Countdown
446		
447		$( '.btCountdownHolder' ).each(function() {
448
449			var cd = $( this );
450			var s = cd.data( 'init-seconds' );
451
452			bt_bb_countdown_output( cd );
453
454			setInterval(function() {
455				bt_bb_countdown_output( cd );
456			}, 1000 );
457		});		
458	}
459
460	// google maps
461
462	window.bt_bb_gmap_init = function ( map_id, zoom, custom_style ) {
463
464		var myLatLng = new google.maps.LatLng( 0, 0 );
465		var mapOptions = {
466			zoom: zoom,
467			center: myLatLng,
468			scrollwheel: false,
469			scaleControl:true,
470			zoomControl: true,
471			zoomControlOptions: {
472				style: google.maps.ZoomControlStyle.SMALL,
473				position: google.maps.ControlPosition.RIGHT_CENTER
474			},
475			streetViewControl: true,
476			mapTypeControl: true
477		}
478
479		var mapElement = document.getElementById( map_id );
480
481		if ( mapElement )
482		{
483			var map = new google.maps.Map( mapElement, mapOptions );
484
485			if ( custom_style != '' ) {
486				
487				var style_array = [];
488				
489				if ( custom_style != '' ) {
490					style_array = JSON.parse( atob( custom_style ) );
491				}
492				
493				var customMapType = new google.maps.StyledMapType( style_array, {
494					name: 'Custom Style'
495				});
496
497				var customMapTypeId = 'custom_style';
498				map.mapTypes.set( customMapTypeId, customMapType );
499				map.setMapTypeId( customMapTypeId );
500			}
501
502			var n = 0;
503
504			var container = jQuery( '#' + map_id ).parent();
505			
506			var locations = container.find( '.bt_bb_map_location' );
507			
508			var center_map = container.data( 'center' );
509			if ( center_map == 'no' ) {
510				center_map = false;
511			} else {
512				center_map = true;
513			}
514
515			var lat_sum = 0;
516			var lng_sum = 0;
517		
518			locations.each(function() {
519				
520				var lat = jQuery( this ).data( 'lat' );
521				var lng = jQuery( this ).data( 'lng' );
522				var icon = jQuery( this ).data( 'icon' );
523
524				lat_sum += parseFloat(lat);
525				lng_sum += parseFloat(lng);
526
527				var myLatLng = new google.maps.LatLng( lat, lng );
528				var marker = new google.maps.Marker({
529					position: myLatLng,
530					map: map,
531					icon: icon,
532					count: n
533				});
534				
535				if ( ! center_map && n == 0 ) {
536					map.setCenter( myLatLng );
537				}
538				
539				locations.eq( 0 ).addClass( 'bt_bb_map_location_show' );
540				
541				marker.addListener( 'click', function() {
542					//map.setZoom( zoom );
543					//map.setCenter( marker.getPosition() );
544					var reload = true;
545					if ( locations.eq( this.count ).hasClass( 'bt_bb_map_location_show' ) && !container.hasClass( 'bt_bb_map_no_overlay' ) ) reload = false; 
546					container.removeClass( 'bt_bb_map_no_overlay' );
547					locations.removeClass( 'bt_bb_map_location_show' );
548					if ( reload ) locations.eq( this.count ).addClass( 'bt_bb_map_location_show' );
549				});
550				
551				n++;
552			});
553
554			if ( center_map ) {
555				var centerLatLng = new google.maps.LatLng( lat_sum / n, lng_sum / n );
556				map.setCenter( centerLatLng );
557			}
558		}
559		
560	}
561	
562	// leaflet map init
563	
564	var map = null;
565	 
566	window.bt_bb_leaflet_init = function ( map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control ) { 
567		onImagesLoaded( $('#' + map_id ).parent(), function() {
568			bt_bb_leaflet_init_late ( map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control );
569		});
570
571	}
572	
573	window.bt_bb_leaflet_init_late = function ( map_id, zoom, max_zoom, predefined_style, custom_style, scroll_wheel, zoom_control ) {
574		
575		var lat_center     = 0;
576		var lng_center     = 0;
577
578		var container   = jQuery( '#' + map_id ).parent();
579		var locations   = container.find( '.bt_bb_leaflet_map_location' );
580		
581		var center_map = container.data( 'center' );
582		
583		if ( center_map == 'no' ) {
584			center_map = false;
585		} else {
586			center_map = true;
587		}
588		
589		var markerClusters = L.markerClusterGroup();
590		
591		var lat_sum = 0;
592		var lng_sum = 0; 
593		var n = 0;
594
595		locations.each(function() {
596
597			var lat     = jQuery( this ).data( 'lat' );
598			var lng     = jQuery( this ).data( 'lng' );
599			var icon    = jQuery( this ).data( 'icon' );
600			lat_sum += parseFloat(lat);
601			lng_sum += parseFloat(lng);
602			
603			if ( n == 0 ) {
604				 lat_center  = lat;
605				 lng_center  =  lng;
606			} 
607			locations.eq( 0 ).addClass( 'bt_bb_map_location_show' ); 
608			locations.eq( 0 ).addClass( 'bt_bb_map_location_show' );
609			
610			var myIcon = L.icon({
611				iconUrl: icon,
612				iconRetinaUrl: icon,
613				iconSize: [45, 58],
614				iconAnchor: [9, 21],
615				popupAnchor: [0, -14]
616			  });
617			// console.log(lat);
618			// console.log(lng);
619			var m = L.marker( [ lat, lng ], { icon: myIcon, id: n,  lat: lat, lng:lng } ).on("click", markerOnClick);
620			markerClusters.addLayer( m );  
621			
622			n++;
623		});
624		
625		if ( center_map ) {
626			lat_center  = lat_sum / n;
627			lng_center  = lng_sum / n;
628		}
629
630		map = L.map( document.getElementById( map_id ) ).setView( [lat_center, lng_center], zoom );
631		
632		var tiles_arr = [];
633		
634		if ( parseInt( predefined_style ) > 0 ) {
635			tiles_arr = tiles_arr.concat( map_leaflet_source_arr[ predefined_style ] );
636		} 
637		
638		if ( custom_style != '' ) {
639			custom_style = atob(custom_style);
640			var tmp_arr = custom_style.split('\n');
641			$.each( tmp_arr, function ( index, tmp ) {
642				
643				tiles_arr = tiles_arr.concat( [tmp.split(',')] );
644			} );
645		}
646		
647		$.each( tiles_arr, function ( index, tile ) {
648			L.tileLayer( 
649				tile[0], 
650				{
651					attribution: tile[1],
652					maxZoom: max_zoom,
653					subdomains: ['a','b','c']
654				}
655			).addTo( map );			
656		} );
657		
658		map.addLayer( markerClusters );
659
660		if ( scroll_wheel == '' ) {
661			map.scrollWheelZoom.disable();
662		}
663		
664		map.removeControl(map.zoomControl);
665		
666		if ( zoom_control ) {
667			L.control.zoom({
668				 position:'topright'
669			}).addTo(map);		
670		}
671		
672
673	   
674		function markerOnClick( e ) {
675			var attributes = e.target.options;
676			var id = attributes.id;
677			var reload = true;
678			if ( locations.eq( id ).hasClass( 'bt_bb_leaflet_map_location_show' ) && !container.hasClass( 'bt_bb_leaflet_map_no_overlay' ) ) reload = false; 
679			container.removeClass( 'bt_bb_leaflet_map_no_overlay' );
680			locations.removeClass( 'bt_bb_leaflet_map_location_show' );
681			if ( reload ) locations.eq( id ).addClass( 'bt_bb_leaflet_map_location_show' );
682			
683			if ( locations.eq( id ).hasClass( 'bt_bb_map_location_show' ) && !container.hasClass( 'bt_bb_map_no_overlay' ) ) reload = false; 
684			container.removeClass( 'bt_bb_map_no_overlay' );
685			locations.removeClass( 'bt_bb_map_location_show' );
686			if ( reload ) locations.eq( id ).addClass( 'bt_bb_map_location_show' );
687		}
688	} 
689	
690	// do event if all images in container are loaded
691	
692	function onImagesLoaded( container, event ) {
693		var images = container.find( '.bt_bb_leaflet_map_content img' );
694		var loaded = images.length;
695		if ( loaded > 0 ) {
696			for (var i = 0; i < images.length; i++ ) {
697				if ( images[i].complete ) {
698					loaded--;
699					if ( loaded == 0 ) {
700						event();
701					}
702				} else {
703					images[i].addEventListener( 'load', function() {
704						loaded--;
705						if ( loaded == 0 ) {
706							event();
707						}
708					});
709				}
710			}			
711		} else {
712			event();
713		} 
714	}
715	
716	// general init
717	
718	var bt_bb_init_finished = false;
719	
720	document.addEventListener('readystatechange', function() {
721		if ( ! bt_bb_init_finished && ( document.readyState === 'interactive' || document.readyState === 'complete' ) ) {
722			bt_bb_init_elements();			
723		
724			if( ! $('body').hasClass('bodyPreloader') ) {
725				bt_bb_animate_elements();	
726			} else {
727				setTimeout( function() {
728					bt_bb_animate_elements();
729				}, 5000 );
730			}
731			$( window ).on( 'scroll', function() { 
732				bt_bb_animate_elements(); 
733			});
734			$( window ).on( 'resize', function( e ) {		
735				setTimeout( function() {
736					var $elems = $( '.bt_bb_counter.animated' );
737					$elems.each(function() {
738						var $elm = $( this );
739						$elm.removeClass( 'animated' );
740						bt_bb_animate_counter( $elm );
741					});
742				}, 1000 );		
743			});
744			bt_bb_init_finished = true;		
745		}
746
747	}, false);
748
749	
750
751}( 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.