PageSourceSearch

https://thebal.ai/wp-content/plugins/industrial/bt_elements.js?ver=7.1.2

js thebal.ai collected 2026-10-05 12:45:06 UTC 11,909 bytes, 420 lines download raw bytes

1(function( $ ) {
2	
3	window.btGetNavHTML = function( count ) {
4		var html = '<div class="btAnimNavHolder"><ul class="btAnimNav">';
5		html += '<li class="btAnimNavPrev"></li>';
6		for ( var i = 0; i < count; i++ ) {
7			html += '<li class="btAnimNavDot" data-count="' + i + '"><span>' + ( i + 1 ) + '/' + count + '<span></li>';
8		}
9		html += '<li class="btAnimNavNext"></li>';
10		html += '</ul></div>';
11		
12		return html;
13	}
14
15	/* Animate elements */
16console.log("btAnimateElements defined");
17	function btAnimateElements() {
18		
19		console.log("btAnimateElements called");
20		
21		var $elems = $( '.btCounter:not(.animated), .btProgressBar:not(.animated)' );
22		
23		console.log($elems);
24		
25		// classic animations
26		$elems.each(function() {
27			$elm = $( this );
28			console.log($elm);
29			console.log($elm.isOnScreen());
30			if ( 
31			( $elm.isOnScreen() && ! $( 'body' ).hasClass( 'impress-enabled' ) ) ||
32			( $elm.isOnScreen() && $( 'body' ).hasClass( 'impress-enabled' ) && $elm.closest( '.boldSection' ).hasClass( 'active' ) )
33			) {
34				$elm.addClass( 'animated' );
35				if ( $elm.hasClass( 'btCounter' ) ) {
36					btAnimateCounter( $elm );
37				}
38				if ( $elm.hasClass( 'btProgressBar' ) ) {
39					btAnimateProgress( $elm );
40				}
41			}
42		});
43	}
44	
45	// new animations, moved from bb
46	window.bt_bb_animate_elements = function () {
47		var $elems = $('.animate:not(.animated)');
48		$elems.each(function () {
49			var $elm = $(this);
50			if (isOnScreen($elm)) {
51				$elm.addClass('animated');
52				if ($elm.hasClass('bt_bb_counter')) {
53					bt_bb_animate_counter($elm);
54				}
55				if (typeof window.local_bt_bb_animate_elements == 'function') {
56					local_bt_bb_animate_elements($elm);
57				}
58			}
59		});
60		bt_bb_lazy_load_images();
61		$('.slick-slider .slick-slide:not(.slick-active) .animate').removeClass('animated');
62	}
63	
64	window.bt_bb_animate_elements_optim = function () {
65
66		const options = {
67			root: null,
68			rootMargin: "0px",
69			treshold: 0,
70		};
71
72		const targetElements_anim = document.querySelectorAll(
73			".animate:not(.animated)"
74		);
75
76		const observer_animation = new IntersectionObserver(function (
77			entries,
78			observer
79		) {
80			entries.forEach((entry) => {
81				if (entry.isIntersecting) {
82					$(entry.target).addClass("animated");
83					if ($(entry.target).hasClass("btCounter")) {
84						// bt_bb_animate_counter($(entry.target));
85						btAnimateCounter($(entry.target));
86					}
87					if ($(entry.target).hasClass("btProgressBar")) {
88						// bt_bb_animate_counter($(entry.target));
89						btAnimateProgress($(entry.target));
90					}
91					if (typeof window.local_bt_bb_animate_elements == "function") {
92						local_bt_bb_animate_elements($(entry.target));
93					}
94
95					observer_animation.unobserve(entry.target);
96				}
97			});
98		},
99			options);
100
101		targetElements_anim.forEach((element) => {
102			observer_animation.observe(element);
103		});
104
105		//bt_bb_lazy_load_images();
106		$(".slick-slider .slick-slide:not(.slick-active) .animate").removeClass(
107			"animated"
108		);
109	};
110
111	function btAnimateCounter( elm ) {
112		var number_length = elm.data( 'digit-length' );
113		for ( var i = parseInt( number_length ); i > 0; i-- ) {
114			var digit = elm.children( '.p' + i ).data( 'digit' );
115			for ( var j = 0; j <= parseInt( digit ); j++ ) {
116				elm.children( '.p' + i ).css( 'transform', 'translateY(-' + parseInt( digit ) * elm.outerHeight() + 'px)' );
117			}
118			
119		}
120		return false;
121	}
122
123	function btAnimateCounterReset( elm ) {
124		var number_length = elm.data( 'digit-length' );
125		for ( var i = parseInt( number_length ); i > 0; i-- ) {
126			var digit = elm.children( '.p' + i ).data( 'digit' );
127			for ( var j = 0; j <= parseInt( digit ); j++ ) {
128				elm.children( '.p' + i ).children( '.n' + j ).css( 'transform', 'translateY(0px)' );
129			}
130			
131		}
132		return false;
133	}
134
135	function btAnimateProgress( elm ) {
136		elm.find( '.btProgressAnim' ).css( 'transition-delay', Math.round( Math.random() * 250 ) + 'ms' );
137		elm.find( '.btProgressAnim' ).css( 'transform', 'translateX(-' + ( 100 - elm.find( '.btProgressAnim' ).data( 'percentage' ) ) + '%)' );
138		return false;
139	}
140	
141	function btAnimateProgressReset( elm ) {
142		elm.find( '.btProgressAnim' ).css( 'transition-delay', Math.round( Math.random() * 250 ) + 'ms' );
143		elm.find( '.btProgressAnim' ).css( 'transform', 'translateX(-100%)' );
144		return false;
145	}	
146	
147	/*$( window ).on( 'btload', function() {
148		if ( ! $( 'body' ).hasClass( 'btPageTransitions' ) ) {
149			btAnimateElements();
150			$( window ).scroll(function(){
151				btAnimateElements();
152			});
153		}
154	});*/
155	
156	// new general init
157
158	var bt_bb_init_finished = false;
159
160	document.addEventListener('readystatechange', function () {
161		if (!bt_bb_init_finished && (document.readyState === 'interactive' || document.readyState === 'complete')) {
162			// bt_bb_init_elements();
163
164			window.addEventListener("load", (event) => {
165
166				if (!$('body').hasClass('bodyPreloader')) {
167					bt_bb_animate_elements_optim();
168				} else {
169					setTimeout(function () {
170						bt_bb_animate_elements_optim();
171					}, 500);
172				}
173
174				if ($('body').hasClass('logged-in') && $('.bt_bb_wrapper').length) {
175					$(window).on('scroll', function () {
176						bt_bb_animate_elements();
177					});
178				}
179
180				$(window).on('resize', function (e) {
181					setTimeout(function () {
182						var $elems = $('.bt_bb_counter.animated');
183						$elems.each(function () {
184							var $elm = $(this);
185							$elm.removeClass('animated');
186							bt_bb_animate_counter($elm);
187						});
188					}, 1000);
189				});
190			});
191
192			bt_bb_init_finished = true;
193
194		}
195
196	}, false);
197	
198	$( window ).on( 'boldthemes_section_animation_end', function( e, el ) {
199		var $elems = $( el ).find( '.btCounter, .btProgressBar, span.headline .animate' );
200		// classic animations
201		$elems.each(function() {
202			$elm = $( this );
203			$elm.addClass( 'animated' );
204			if ( $elm.hasClass( 'btCounter' ) ) {
205				btAnimateCounter( $elm );
206			}
207			if ( $elm.hasClass( 'btProgressBar' ) ) {
208				btAnimateProgress( $elm );
209			}
210		});
211	});
212	
213	$( window ).on( 'boldthemes_section_animation_out', function( e, el ) {
214		var $elems = $( el ).find( '.btCounter, .btProgressBar, span.headline .animate' );
215		// classic animations
216		$elems.each(function() {
217			$elm = $( this );
218			$elm.removeClass( 'animated' );
219			if ( $elm.hasClass( 'btCounter' ) ) {
220				btAnimateCounterReset( $elm );
221			}
222			if ( $elm.hasClass( 'btProgressBar' ) ) {
223				btAnimateProgressReset( $elm );
224			}
225		});
226	});
227	
228	function bt_video_background() {
229		$( '.boldSection.video' ).each(function() {
230			var video = $( this ).find( 'video' );
231			var w = $( this ).outerWidth();
232			var h = $( this ).outerHeight();
233			if ( w / h > 16 / 9 ) {
234				video.css( 'width', '105%' );
235				video.css( 'height', '' );
236			} else {
237				video.css( 'width', '' );
238				video.css( 'height', '105%' );
239			}
240		});
241	}
242	
243	window.bt_video_callback = function( v ) {
244		$( v ).parent().addClass( 'video_on' );
245	}
246	
247	$( window ).on( 'resize', function( e ) {
248		/*var $elems = $( '.btCounter' );
249		setTimeout( function() {
250			var $elems = $( '.btCounter' );
251			$elems.each(function() {
252				$elm = $( this );
253				btAnimateCounter( $elm );
254			});
255		}, 1000 );*/
256		
257		bt_video_background();		
258		
259	});
260	
261	/* Accordions and tabs */
262
263	$( document ).ready(function () {
264		
265		/* Accordions */
266
267		$( '.tabsVertical .tabAccordionContent' ).hide();
268		
269		$( '.tabsVertical .tabAccordionTitle' ).click(function() {
270			if ( $( this ).hasClass( 'on' ) ) {
271				$( this ).removeClass( 'on' ).next().slideUp( 250 );
272			} else {
273				$( this ).closest( '.tabsVertical' ).find( '.tabAccordionTitle' ).removeClass( 'on' );
274				$( this ).closest( '.tabsVertical' ).find( '.tabAccordionContent' ).delay( 250 ).slideUp( 250 );
275				$( this ).addClass( 'on' ).next().slideDown( 250 );
276			}
277		});
278		
279		$( '.tabsVertical' ).each(function(){
280			$( this ).find( '.tabAccordionTitle' ).first().click();
281		});
282
283		/* Tabs */
284		
285		$( '.tabsHorizontal ul.tabsHeader li' ).click(function() {
286			$(this).siblings().removeClass( 'on' );
287			$( this ).addClass( 'on' );
288			$( this ).parent().parent().find( '.tabPanes .tabPane' ).removeClass( 'on' );
289			$( this ).parent().parent().find( '.tabPanes .tabPane' ).find( '.animated' ).removeClass( 'animated' );
290			$( this ).parent().parent().find( '.tabPanes .tabPane' ).eq( $(this).index() ).addClass( 'on' );
291			$( this ).parent().parent().find( '.tabPanes .tabPane' ).eq( $(this).index() ).find( '.animate' ).addClass( 'animated' );
292		});
293
294		$( '.tabsHorizontal ul.tabsHeader' ).each(function(){
295			$( this ).find( 'li' ).first().click();
296		});
297
298		// Wrap inline row
299		$( '.btIconImageRow > div' ).wrap( '<div class="btIconImageCell"></div>' );
300		$.each( $( '.btIconImageRow' ), function() {
301			if( $( this ).children( 'div.btIconImageCell' ).length > 0 ) {
302				$( this ).addClass( 'btHasRows btCells-' + $( this ).children( 'div.btIconImageCell' ).length );	
303			}
304			
305		});
306
307		// Countdown
308		
309		$( '.btCountdownHolder' ).each(function() {
310			
311			var cd = $( this );
312			var s = cd.data( 'init-seconds' );
313			if ( cd.data( 'init-target-seconds' ) ) {
314				var now_utc_seconds = Math.floor( new Date().getTime() / 1000);;
315				var s = cd.data( 'init-target-seconds' ) - now_utc_seconds;
316				if ( s < 0 ) {
317					s = 0;
318				}
319			}
320			
321			var seconds_arr = ['', ''];
322			var seconds_arr_prev = ['', ''];
323			
324			var minutes_arr = ['', ''];
325			var minutes_arr_prev = ['', ''];
326			
327			var hours_arr = ['', ''];
328			var hours_arr_prev = ['', ''];
329
330			var days_prev = 0;
331			
332			var countdown = function( selector, i, arr, arr_prev ) {
333				if ( arr[ i ] !== arr_prev[ i ] ) {
334					cd.find( selector ).children().addClass( 'countdown_anim' );
335					cd.find( selector ).children().eq( 0 ).html( arr[ i ] );
336					cd.find( selector ).children().eq( 1 ).html( arr_prev[ i ] );
337					setTimeout(function() {
338						cd.find( selector ).children().eq( 1 ).html( cd.find( selector ).children().eq( 0 ).html() );
339						cd.find( selector ).children().removeClass( 'countdown_anim' );
340					}, 300 );
341				}
342			}
343			
344			var output = function() {
345				s = s - 1;
346				if ( s < 0 ) {
347					s = 0;
348				}
349				
350				var delta = s;
351				
352				var days = Math.floor( delta / 86400 );
353				delta -= days * 86400;
354
355				var hours = Math.floor( delta / 3600 ) % 24;
356				delta -= hours * 3600;
357
358				var minutes = Math.floor( delta / 60 ) % 60;
359				delta -= minutes * 60;
360
361				var seconds = delta;
362				
363				if ( hours < 10 ) {
364					hours = '0' + hours;
365				}
366				
367				if ( minutes < 10 ) {
368					minutes = '0' + minutes;
369				}
370
371				if ( seconds < 10 ) {
372					seconds = '0' + seconds;
373				}
374				
375				seconds_arr = seconds.toString().split( '' );
376				minutes_arr = minutes.toString().split( '' );
377				hours_arr = hours.toString().split( '' );
378				
379				for ( var i = 0; i <= 1; i++ ) {
380					countdown( '.seconds .n' + i, i, seconds_arr, seconds_arr_prev );
381					countdown( '.minutes .n' + i, i, minutes_arr, minutes_arr_prev );
382					countdown( '.hours .n' + i, i, hours_arr, hours_arr_prev );
383				}
384				
385				if ( days != days_prev ) {
386					days_arr = days.toString().split( '' );
387					
388					var days_html = '';
389					for ( var i = 0; i < days_arr.length; i++ ) {
390						days_html += '<span><span>' + days_arr[ i ] + '</span></span>';
391					}
392
393					cd.find( '.days .numbers' ).html( days_html );
394				}
395				
396				days_prev = days;				
397				
398				setTimeout(function() {
399					seconds_arr_prev = seconds_arr;
400					minutes_arr_prev = minutes_arr;
401					hours_arr_prev = hours_arr;
402				}, 400 );
403
404			}
405			
406			output();
407
408			setInterval(function() {
409				output();
410			}, 1000 );
411		});
412		
413		// Video
414		
415		bt_video_background();	
416		
417
418	});
419
420})( 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.