PageSourceSearch

https://softaware-project.eu/wp-content/plugins/tm-header-banner/assets/js/scripts.js?ver=1.0.0

js softaware-project.eu collected 2026-10-04 07:05:06 UTC 3,576 bytes, 161 lines download raw bytes

1/**
2 * TM Header Banner scripts
3 */
4/*globals CherryJsCore, Cookies*/
5! ( function( $ ) {
6	'use strict';
7
8	CherryJsCore.utilites.namespace( 'tm_header_banner' );
9
10	CherryJsCore.tm_header_banner = {
11
12		init: function() {
13
14			if ( CherryJsCore.status.is_ready ) {
15				this.ready.call( this );
16			} else {
17				CherryJsCore.variable.$document.on( 'ready', this.ready.bind( this ) );
18			}
19		},
20
21		debounce: function( callback, threshold ) {
22			var timeout;
23
24			return function debounced() {
25				function delayed() {
26					callback();
27					timeout = null;
28				}
29
30				if ( timeout ) {
31					clearTimeout( timeout );
32				}
33
34				timeout = setTimeout( delayed, threshold );
35			};
36		},
37
38		ready: function() {
39			var _this = this,
40				init,
41				$adminbar = $( '#wpadminbar' ),
42				$headerBanner = $( '.tm-hb__wrapper' ),
43				$body = $( 'body' ),
44				$preloader = $( '.page-preloader-cover' ),
45				originalAnimationSpeed = $headerBanner.data( 'animation-speed' ) || 200,
46				clearCookie = 'true' === $headerBanner.data( 'cc' ),
47				scrollOffset,
48				adminBarOffset,
49				animationSpeed,
50				headerBannerHeight,
51				cookieOptions = {
52					path: ''
53				},
54				recalc;
55
56			if ( 0 === $headerBanner.length ) {
57				return false;
58			}
59
60			animationSpeed = originalAnimationSpeed;
61
62			recalc = function() {
63
64				headerBannerHeight = $headerBanner.height();
65				adminBarOffset = $adminbar.height();
66
67				$headerBanner.css( {
68					height: 0,
69					display: 'block'
70				} ).animate( {
71					height: headerBannerHeight,
72					opacity: 1,
73					top: adminBarOffset
74				}, animationSpeed );
75
76				$body.animate( {
77					paddingTop: headerBannerHeight
78				}, animationSpeed );
79			};
80
81			init = function() {
82				if ( $headerBanner.hasClass( 'tm-hb__wrapper--animate' ) ) {
83
84					recalc();
85					$headerBanner.addClass( 'tm-hb__wrapper--animated' );
86
87					window.addEventListener( 'scroll', _this.debounce( function() {
88						scrollOffset = window.scrollY;
89						adminBarOffset = $adminbar.height();
90
91						if ( $adminbar.hasClass( 'mobile' ) ) {
92							if ( adminBarOffset < scrollOffset &&
93								 $headerBanner.hasClass( 'tm-hb__wrapper--floating' ) &&
94								( window.hasOwnProperty( 'orientation' ) &&
95								  90 !== Math.abs( window.orientation ) ) ) {
96								$headerBanner.css( {
97									top: 0
98								}, 200 );
99							} else {
100								$headerBanner.css( {
101									top: adminBarOffset
102								}, 200 );
103							}
104						}
105					}, 10 ) );
106				}
107
108				if ( Cookies ) {
109					if ( clearCookie ) {
110						Cookies.remove( 'tm-header-banner-clicked', cookieOptions );
111					}
112				}
113			};
114
115			if ( 0 < $preloader.length ) {
116				setTimeout( init, 1000 );
117			} else {
118				init();
119
120				window.addEventListener( 'orientationchange', recalc );
121			}
122
123			$headerBanner.on( 'click', 'a, button', function() {
124				$headerBanner.removeClass( 'tm-hb__wrapper--animated' );
125
126				if ( $headerBanner.data( 'reactivation' ) ) {
127					cookieOptions.expires = $headerBanner.data( 'reactivation' );
128				}
129
130				if ( Cookies ) {
131					Cookies.set( 'tm-header-banner-clicked', 'yes', cookieOptions );
132				}
133
134				animationSpeed = originalAnimationSpeed;
135
136				if ( ! $headerBanner.hasClass( 'tm-hb__wrapper--animate' ) ) {
137					$headerBanner.css( {
138						display: 'none'
139					} );
140					$body.removeClass( 'tm-hb-enabled' );
141
142					return false;
143				}
144
145				$headerBanner.animate( {
146					height: 0,
147					opacity: 0
148				}, animationSpeed );
149
150				$body.animate( {
151					paddingTop: 0
152				}, animationSpeed, function() {
153					$body.removeClass( 'tm-hb-enabled' );
154				} );
155			} );
156		}
157	};
158
159	CherryJsCore.tm_header_banner.init();
160
161}( 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.